From 062f344676863a27951d05c866b909f100f317fc Mon Sep 17 00:00:00 2001 From: sergeych Date: Sat, 29 Nov 2025 09:02:28 +0100 Subject: [PATCH] published lyngio to maven, added to docs --- README.md | 5 ++--- docs/lyng.io.fs.md | 20 ++++++++++++-------- lyngio/build.gradle.kts | 27 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4a52653..568fe09 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Lyng: modern scripting for kotlin multiplatform -Please visit the project homepage: [https://lynglang.com](https://lynglang.com) - -A KMP library and a standalone interpreter. v1.0.0-SNAPSHOT is now available. +Please visit the project homepage: [https://lynglang.com](https://lynglang.com) and a [telegram channel](https://t.me/lynglang) for updates. - simple, compact, intuitive and elegant modern code: @@ -39,6 +37,7 @@ and it is multithreaded on platforms supporting it (automatically, no code chang ## Resources: +- [Language home](https://lynglang.com) - [introduction and tutorial](docs/tutorial.md) - start here please - [Samples directory](docs/samples) - [Books directory](docs) diff --git a/docs/lyng.io.fs.md b/docs/lyng.io.fs.md index a39acc7..4bb96e5 100644 --- a/docs/lyng.io.fs.md +++ b/docs/lyng.io.fs.md @@ -8,27 +8,31 @@ This module provides a uniform, suspend-first filesystem API to Lyng scripts, ba It exposes a Lyng class `Path` with methods for file and directory operations, including streaming readers for large files. +It is a separate library because access to teh filesystem is a security risk we compensate with a separate API that user must explicitly include to the dependency and allow. Together with `FsAceessPolicy` that is required to `createFs()` which actually adds the filesystem to the scope, the security risk is isolated. + +Also, it helps keep Lyng core small and focused. + --- #### Add the library to your project (Gradle) If you use this repository as a multi-module project, add a dependency on `:lyngio`: -```kotlin -dependencies { - implementation(project(":lyngio")) -} -``` - -If you consume it as a published artifact (group and version may vary): - ```kotlin dependencies { implementation("net.sergeych:lyngio:0.0.1-SNAPSHOT") } ``` +Note on maven repository. Lyngio uses ths same maven as Lyng code (`lynglib`) so it is most likely already in your project. If ont, add it to the proper section of your `build.gradle.kts` or settings.gradle.kts: + +```kotlin + repositories { + maven("https://gitea.sergeych.net/api/packages/SergeychWorks/maven") + } +``` This brings in: + - `:lynglib` (Lyng engine) - Okio (`okio`, `okio-fakefilesystem`, and `okio-nodefilesystem` for JS) - Kotlin coroutines diff --git a/lyngio/build.gradle.kts b/lyngio/build.gradle.kts index e1ed772..654e347 100644 --- a/lyngio/build.gradle.kts +++ b/lyngio/build.gradle.kts @@ -26,6 +26,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.androidLibrary) + `maven-publish` } group = "net.sergeych" @@ -68,6 +69,14 @@ kotlin { } sourceSets { + all { + languageSettings.optIn("kotlin.ExperimentalUnsignedTypes") +// languageSettings.optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") + // Correct opt-in markers for coroutines +// languageSettings.optIn("kotlinx.coroutines.DelicateCoroutinesApi") +// languageSettings.optIn("kotlin.contracts.ExperimentalContracts") +// languageSettings.optIn("kotlinx.coroutines.FlowPreview") + } val commonMain by getting { dependencies { api(project(":lynglib")) @@ -123,3 +132,21 @@ android { tasks.matching { it.name.startsWith("lint", ignoreCase = true) }.configureEach { this.enabled = false } + +publishing { + val mavenToken by lazy { + File("${System.getProperty("user.home")}/.gitea_token").readText() + } + repositories { + maven { + credentials(HttpHeaderCredentials::class) { + name = "Authorization" + value = mavenToken + } + url = uri("https://gitea.sergeych.net/api/packages/SergeychWorks/maven") + authentication { + create("Authorization", HttpHeaderAuthentication::class) + } + } + } +}