From 2886b7b20050999a8f8becbb03a1572171461854 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 22 Mar 2023 10:45:09 +0300 Subject: [PATCH 01/50] Relax publishing rules. Add a way to regulate publishing targets from parameters --- CHANGELOG.md | 1 + build.gradle.kts | 1 - gradle/libs.versions.toml | 2 +- .../kscience/gradle/KScienceExtension.kt | 28 +++++++++-- .../kscience/gradle/internal/publishing.kt | 50 +++++++------------ 5 files changed, 43 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e24c1f6..30cc377 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added ### Changed +- All publishing is enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. ### Deprecated diff --git a/build.gradle.kts b/build.gradle.kts index 31937c6..7924869 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -211,7 +211,6 @@ publishing { } } - kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(11)) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index fb846f7..23110d9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -tools = "0.14.4-kotlin-1.8.20-RC" +tools = "0.14.5-kotlin-1.8.20-RC" kotlin = "1.8.20-RC" atomicfu = "0.19.0" binary-compatibility-validator = "0.12.1" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 1ac0bfb..83fd2cc 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask import space.kscience.gradle.internal.defaultKotlinJvmArgs import space.kscience.gradle.internal.fromJsDependencies +import space.kscience.gradle.internal.requestPropertyOrNull import space.kscience.gradle.internal.useCommonDependency public enum class DependencyConfiguration { @@ -292,14 +293,30 @@ public data class KScienceNativeTarget( } } -public class KScienceNativeConfiguration { +public class KScienceNativeConfiguration(private val project: Project) { internal companion object { - private fun defaultNativeTargets(): Map { - + private fun defaultNativeTargets(project: Project): Map { val hostOs = System.getProperty("os.name") + + val targets = project.requestPropertyOrNull("publishing.targets") + return when { + targets == "all" -> listOf( + KScienceNativeTarget.linuxX64, + KScienceNativeTarget.mingwX64, + KScienceNativeTarget.macosX64, + KScienceNativeTarget.macosArm64, + KScienceNativeTarget.iosX64, + KScienceNativeTarget.iosArm64, + KScienceNativeTarget.iosSimulatorArm64, + ) + + targets != null -> { + targets.split(",").map { KScienceNativeTarget(KotlinNativePreset.valueOf(it)) } + } + hostOs.startsWith("Windows") -> listOf( KScienceNativeTarget.linuxX64, KScienceNativeTarget.mingwX64 @@ -314,6 +331,7 @@ public class KScienceNativeConfiguration { ) hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64) + else -> { emptyList() } @@ -322,7 +340,7 @@ public class KScienceNativeConfiguration { } - internal var targets: Map = defaultNativeTargets() + internal var targets: Map = defaultNativeTargets(project) /** @@ -459,7 +477,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro * Enable all supported native targets */ public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) { - val nativeConfiguration = KScienceNativeConfiguration().apply(block) + val nativeConfiguration = KScienceNativeConfiguration(this).apply(block) pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { configure { val nativeTargets: List = diff --git a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt index f0d15c3..738e5f4 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt @@ -116,22 +116,18 @@ internal fun Project.addGithubPublishing( githubOrg: String, githubProject: String, ) { - if (requestPropertyOrNull("publishing.enabled") != "true") { - logger.info("Skipping github publishing because publishing is disabled") - return - } - if (requestPropertyOrNull("publishing.github") != "false") { - logger.info("Skipping github publishing because `publishing.github != true`") - return - } + val githubUser: String? = requestPropertyOrNull("publishing.github.user") + val githubToken: String? = requestPropertyOrNull("publishing.github.token") - val githubUser: String = requestProperty("publishing.github.user") - val githubToken: String = requestProperty("publishing.github.token") + if (githubUser == null || githubToken == null) { + logger.info("Skipping Github publishing because Github credentials are not defined") + return + } allprojects { plugins.withId("maven-publish") { configure { - logger.info("Adding github publishing to project [${project.name}]") + logger.info("Adding Github publishing to project [${project.name}]") repositories.maven { name = "github" @@ -148,23 +144,18 @@ internal fun Project.addGithubPublishing( } internal fun Project.addSpacePublishing(spaceRepo: String) { - if (requestPropertyOrNull("publishing.enabled") != "true") { - logger.info("Skipping space publishing because publishing is disabled") + val spaceUser: String? = requestPropertyOrNull("publishing.space.user") + val spaceToken: String? = requestPropertyOrNull("publishing.space.token") + + if (spaceUser == null || spaceToken == null) { + logger.info("Skipping Space publishing because Space credentials are not defined") return } - if (requestPropertyOrNull("publishing.space") == "false") { - logger.info("Skipping space publishing because `publishing.space == false`") - return - } - - val spaceUser: String = requestProperty("publishing.space.user") - val spaceToken: String = requestProperty("publishing.space.token") - allprojects { plugins.withId("maven-publish") { configure { - project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") + project.logger.info("Adding SPC Space publishing to project [${project.name}]") repositories.maven { name = "space" @@ -181,24 +172,19 @@ internal fun Project.addSpacePublishing(spaceRepo: String) { } internal fun Project.addSonatypePublishing() { - if (requestPropertyOrNull("publishing.enabled") != "true") { - logger.info("Skipping sonatype publishing because publishing is disabled") - return - } - if (isInDevelopment) { logger.info("Sonatype publishing skipped for development version") return } - if (requestPropertyOrNull("publishing.sonatype") == "false") { - logger.info("Skipping sonatype publishing because `publishing.sonatype == false`") + val sonatypeUser: String? = requestPropertyOrNull("publishing.sonatype.user") + val sonatypePassword: String? = requestPropertyOrNull("publishing.sonatype.password") + + if (sonatypeUser == null || sonatypePassword == null) { + logger.info("Skipping Sonatype publishing because Sonatype credentials are not defined") return } - val sonatypeUser: String = requestProperty("publishing.sonatype.user") - val sonatypePassword: String = requestProperty("publishing.sonatype.password") - allprojects { plugins.withId("maven-publish") { configure { -- 2.34.1 From 2e3b74eb63db48e6e794b24ebf16dd7761434a7f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 22 Mar 2023 11:14:05 +0300 Subject: [PATCH 02/50] update dokka version --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 23110d9..f3b90d2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ kotlin = "1.8.20-RC" atomicfu = "0.19.0" binary-compatibility-validator = "0.12.1" changelog = "2.0.0" -dokka = "1.7.20" +dokka = "1.8.10" kotlin-jupyter = "0.11.0-317" kotlinx-benchmark = "0.4.7" kotlinx-cli = "0.3.5" -- 2.34.1 From 9fc8d96e88619630a17a8719925ab6049d6fb869 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 22 Mar 2023 18:15:35 +0300 Subject: [PATCH 03/50] Fixed macosArm64 target --- src/main/kotlin/space/kscience/gradle/KScienceExtension.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 83fd2cc..a0f1a1d 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -286,7 +286,7 @@ public data class KScienceNativeTarget( public val linuxX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.linuxX64) public val mingwX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.mingwX64) public val macosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64) - public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64) + public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosArm64) public val iosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosX64) public val iosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosArm64) public val iosSimulatorArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosSimulatorArm64) -- 2.34.1 From 512954b510af126120de64447c4945c6e3daad89 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 5 Apr 2023 13:55:32 +0300 Subject: [PATCH 04/50] Update dependencies. Make optional configuraion for sonatype repo --- gradle/libs.versions.toml | 23 +++++++++++-------- .../kscience/gradle/KScienceProjectPlugin.kt | 4 ++-- .../kscience/gradle/internal/publishing.kt | 4 ++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f3b90d2..b7baf37 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,11 +1,11 @@ [versions] -tools = "0.14.5-kotlin-1.8.20-RC" -kotlin = "1.8.20-RC" -atomicfu = "0.19.0" -binary-compatibility-validator = "0.12.1" +tools = "0.14.6-kotlin-1.8.20" +kotlin = "1.8.20" +atomicfu = "0.20.0" +binary-compatibility-validator = "0.13.0" changelog = "2.0.0" dokka = "1.8.10" -kotlin-jupyter = "0.11.0-317" +kotlin-jupyter = "0.11.0-349" kotlinx-benchmark = "0.4.7" kotlinx-cli = "0.3.5" kotlinx-coroutines = "1.6.4" @@ -13,14 +13,15 @@ kotlinx-datetime = "0.4.0" kotlinx-html = "0.8.0" kotlinx-knit = "0.4.0" kotlinx-nodejs = "0.0.7" +#old version due to xml inclompatibility kotlinx-serialization = "1.4.1" -ktor = "2.2.3" +ktor = "2.2.4" xmlutil = "0.84.3" yamlkt = "0.12.0" -jsBom = "1.0.0-pre.509" +jsBom = "1.0.0-pre.530" junit = "5.9.2" compose = "1.3.0" -logback = "1.4.5" +logback = "1.4.6" [libraries] atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } @@ -37,6 +38,8 @@ kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", v kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" } +kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:", version.ref = "jsBom" } + kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } @@ -79,13 +82,13 @@ xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", v yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } -logback-classic = {module = "ch.qos.logback:logback-classic", version.ref = "logback"} +logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } -compose = {id = "org.jetbrains.compose", version.ref = "compose"} +compose = { id = "org.jetbrains.compose", version.ref = "compose" } gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" } gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index b979c69..2b73d9e 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -88,9 +88,9 @@ public class KSciencePublishingExtension(public val project: Project) { * * @param addToRelease publish packages in the `release` task to the Sonatype repository. */ - public fun sonatype() { + public fun sonatype(sonatypeRoot: String = "https://s01.oss.sonatype.org") { require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" } - project.addSonatypePublishing() + project.addSonatypePublishing(sonatypeRoot) } } diff --git a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt index 738e5f4..5eabab6 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt @@ -171,7 +171,7 @@ internal fun Project.addSpacePublishing(spaceRepo: String) { } } -internal fun Project.addSonatypePublishing() { +internal fun Project.addSonatypePublishing(sonatypeRoot: String) { if (isInDevelopment) { logger.info("Sonatype publishing skipped for development version") return @@ -189,7 +189,7 @@ internal fun Project.addSonatypePublishing() { plugins.withId("maven-publish") { configure { repositories.maven { - val sonatypeRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2" + val sonatypeRepo = "$sonatypeRoot/service/local/staging/deploy/maven2" name = "sonatype" url = uri(sonatypeRepo) -- 2.34.1 From d3432643e8e5eb4ed0ff630151c8645219a91cf3 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 5 Apr 2023 15:28:46 +0300 Subject: [PATCH 05/50] Update dependencies. Make optional configuraion for sonatype repo --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b7baf37..2aa54e8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -38,7 +38,7 @@ kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", v kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" } -kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:", version.ref = "jsBom" } +kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "jsBom" } kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } -- 2.34.1 From 70c190d7fa0120e16b1a7f286d3d670191e852d9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 16 Apr 2023 13:51:38 +0300 Subject: [PATCH 06/50] Fix wasm target configuration --- gradle/libs.versions.toml | 4 ++-- .../space/kscience/gradle/KScienceExtension.kt | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2aa54e8..f5ecdf9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -tools = "0.14.6-kotlin-1.8.20" +tools = "0.14.7-kotlin-1.8.20" kotlin = "1.8.20" atomicfu = "0.20.0" binary-compatibility-validator = "0.13.0" @@ -20,7 +20,7 @@ xmlutil = "0.84.3" yamlkt = "0.12.0" jsBom = "1.0.0-pre.530" junit = "5.9.2" -compose = "1.3.0" +compose = "1.4.0" logback = "1.4.6" [libraries] diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index a0f1a1d..7a4b15e 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -426,9 +426,24 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { wasm { - browser() + browser { + testTask { + useKarma { + this.webpackConfig.experiments.add("topLevelAwait") + useChromeHeadless() + useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) + } + } + } block() } + sourceSets { + getByName("wasmTest") { + dependencies { + implementation(kotlin("test")) + } + } + } } } } -- 2.34.1 From b05617ce9a1a8a2dbd24b6db03f1293c236ee8ba Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 26 May 2023 09:18:59 +0300 Subject: [PATCH 07/50] 0.14.8 --- gradle/libs.versions.toml | 25 +++++++++---------- .../gradle/KScienceReadmeExtension.kt | 8 +++++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f5ecdf9..42a5592 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,27 +1,26 @@ [versions] -tools = "0.14.7-kotlin-1.8.20" +tools = "0.14.8-kotlin-1.8.20" kotlin = "1.8.20" -atomicfu = "0.20.0" -binary-compatibility-validator = "0.13.0" +atomicfu = "0.20.2" +binary-compatibility-validator = "0.13.1" changelog = "2.0.0" dokka = "1.8.10" -kotlin-jupyter = "0.11.0-349" +kotlin-jupyter = "0.11.0-360" kotlinx-benchmark = "0.4.7" kotlinx-cli = "0.3.5" -kotlinx-coroutines = "1.6.4" +kotlinx-coroutines = "1.7.0-RC" kotlinx-datetime = "0.4.0" kotlinx-html = "0.8.0" kotlinx-knit = "0.4.0" kotlinx-nodejs = "0.0.7" -#old version due to xml inclompatibility -kotlinx-serialization = "1.4.1" -ktor = "2.2.4" -xmlutil = "0.84.3" -yamlkt = "0.12.0" -jsBom = "1.0.0-pre.530" -junit = "5.9.2" +kotlinx-serialization = "1.5.0" +ktor = "2.3.0" +xmlutil = "0.86.0" +yamlkt = "0.13.0" +jsBom = "1.0.0-pre.546" +junit = "5.9.3" compose = "1.4.0" -logback = "1.4.6" +logback = "1.4.7" [libraries] atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt index b79e64f..a63fa26 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt @@ -88,12 +88,18 @@ public class KScienceReadmeExtension(public val project: Project) { public data class Feature(val id: String, val description: String, val ref: String?, val name: String = id) - public val features: MutableList = ArrayList() + public val features: MutableList = mutableListOf() + /** + * A plain readme feature with description + */ public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) { features += Feature(id, description(), ref, name) } + /** + * A readme feature with HTML description + */ public fun featureWithHtml( id: String, ref: String? = null, -- 2.34.1 From 021f78c510bfe0b29f05f503024dbac895c8182d Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 29 May 2023 12:58:19 +0300 Subject: [PATCH 08/50] 0.14.9 - fix duplicating JS source code publication --- gradle/libs.versions.toml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../kotlin/space/kscience/gradle/KScienceExtension.kt | 10 ++++++++-- .../space/kscience/gradle/internal/publishing.kt | 9 --------- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 42a5592..3ff791e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -tools = "0.14.8-kotlin-1.8.20" +tools = "0.14.9-kotlin-1.8.20" kotlin = "1.8.20" atomicfu = "0.20.2" binary-compatibility-validator = "0.13.1" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e1bef7e..fae0804 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 7a4b15e..9657003 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl @@ -208,6 +209,7 @@ public open class KScienceExtension(public val project: Project) { /** * Mark this module as an application module. JVM application should be enabled separately */ + @Deprecated("Use platform-specific applications") public fun application() { project.extensions.findByType()?.apply { explicitApi = null @@ -423,6 +425,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro @OptIn(ExperimentalWasmDsl::class) public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { + if(project.requestPropertyOrNull("kscience.wasm.disabled") == "true"){ + project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") + return + } + project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { wasm { @@ -474,8 +481,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro } jvm { val processResourcesTaskName = - compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME] - .processResourcesTaskName + compilations[KotlinCompilation.MAIN_COMPILATION_NAME].processResourcesTaskName val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution") diff --git a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt index 5eabab6..ae247d1 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt @@ -27,19 +27,10 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit plugins.withId("org.jetbrains.kotlin.js") { val kotlin: KotlinJsProjectExtension = extensions.findByType()!! - val sourcesJar by tasks.creating(Jar::class) { - archiveClassifier.set("sources") - kotlin.sourceSets.forEach { - from(it.kotlin) - } - } - publications.create("js") { kotlin.targets.flatMap { it.components }.forEach { from(it) } - - artifact(sourcesJar) } } -- 2.34.1 From 4238dc5a43b5b73392d9ed4d851d94050c7de04c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 2 Jun 2023 13:40:59 +0300 Subject: [PATCH 09/50] kotlin 1.9.0-Beta --- gradle/libs.versions.toml | 4 ++-- .../space/kscience/gradle/KScienceExtension.kt | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3ff791e..5a49166 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.14.9-kotlin-1.8.20" -kotlin = "1.8.20" +tools = "0.14.9-kotlin-1.9.0-Beta" +kotlin = "1.9.0-Beta" atomicfu = "0.20.2" binary-compatibility-validator = "0.13.1" changelog = "2.0.0" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 9657003..d3b2bc9 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -425,7 +425,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro @OptIn(ExperimentalWasmDsl::class) public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { - if(project.requestPropertyOrNull("kscience.wasm.disabled") == "true"){ + if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") return } @@ -473,7 +473,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro binaries.executable() browser { webpackTask { - outputFileName = bundleName + mainOutputFileName.set(bundleName) } browserConfig() } @@ -560,6 +560,14 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro } configure(nativeTargets) { + + //TODO remove after https://youtrack.jetbrains.com/issue/KT-58837 + compilations.configureEach { + compilerOptions.configure { + freeCompilerArgs.add("-Xpartial-linkage=disable") + } + } + compilations["main"]?.apply { configure(kotlinSourceSets) { dependsOn(nativeMain) -- 2.34.1 From 5463c9326b3d4e70c921b1a0a1a228788ad72b61 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 7 Jun 2023 15:14:13 +0300 Subject: [PATCH 10/50] Add gc to wasm --- gradle/libs.versions.toml | 2 +- .../space/kscience/gradle/KScienceExtension.kt | 2 +- .../kscience/gradle/KScienceProjectPlugin.kt | 15 ++++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5a49166..257c55c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -tools = "0.14.9-kotlin-1.9.0-Beta" +tools = "0.14.9-kotlin-1.9.0-Beta-dev-3" kotlin = "1.9.0-Beta" atomicfu = "0.20.2" binary-compatibility-validator = "0.13.1" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index d3b2bc9..44dde80 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -437,7 +437,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro testTask { useKarma { this.webpackConfig.experiments.add("topLevelAwait") - useChromeHeadless() + useChromeHeadlessWasmGc() useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) } } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index 2b73d9e..4e1dda3 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -12,6 +12,9 @@ import org.jetbrains.changelog.ChangelogPlugin import org.jetbrains.changelog.ChangelogPluginExtension import org.jetbrains.dokka.gradle.AbstractDokkaTask import org.jetbrains.dokka.gradle.DokkaPlugin +import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport +import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin +import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension import space.kscience.gradle.internal.* /** @@ -104,8 +107,8 @@ public open class KScienceProjectPlugin : Plugin { apply() apply() - allprojects{ - repositories{ + allprojects { + repositories { mavenCentral() maven("https://repo.kotlin.link") maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev") @@ -250,9 +253,11 @@ public open class KScienceProjectPlugin : Plugin { } } - plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) { - rootProject.the().lockFileDirectory = - rootDir.resolve("gradle") + plugins.withType() { + rootProject.configure { + lockFileDirectory = rootDir.resolve("gradle") + yarnLockMismatchReport = YarnLockMismatchReport.WARNING + } } } -- 2.34.1 From a62503ac4157d84a7333a5bc914f3639a067289a Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 9 Jun 2023 17:22:36 +0300 Subject: [PATCH 11/50] add debelopment mode for fullstack --- CHANGELOG.md | 3 ++- .../kotlin/space/kscience/gradle/KScienceExtension.kt | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30cc377..b41fce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- Add development mode for fullstack. ### Changed -- All publishing is enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. +- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. ### Deprecated diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 9657003..3535991 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -425,7 +425,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro @OptIn(ExperimentalWasmDsl::class) public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { - if(project.requestPropertyOrNull("kscience.wasm.disabled") == "true"){ + if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") return } @@ -465,6 +465,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro */ public fun fullStack( bundleName: String = "js/bundle.js", + development: Boolean = false, jvmConfig: KotlinJvmTarget.() -> Unit = {}, jsConfig: KotlinJsTargetDsl.() -> Unit = {}, browserConfig: KotlinJsBrowserDsl.() -> Unit = {}, @@ -483,7 +484,10 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro val processResourcesTaskName = compilations[KotlinCompilation.MAIN_COMPILATION_NAME].processResourcesTaskName - val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution") + + val jsBrowserDistribution = project.tasks.getByName( + if (development) "jsBrowserDevelopmentExecutableDistribution" else "jsBrowserDistribution" + ) project.tasks.getByName(processResourcesTaskName) { duplicatesStrategy = DuplicatesStrategy.WARN -- 2.34.1 From 8272c4ae4d1a788df9c87e5e3f33376f564592de Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 22 Jun 2023 20:28:21 +0300 Subject: [PATCH 12/50] 1.9.0-RC --- gradle/libs.versions.toml | 8 ++++---- .../kotlin/space/kscience/gradle/KScienceExtension.kt | 7 ------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 257c55c..ce4862f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.14.9-kotlin-1.9.0-Beta-dev-3" -kotlin = "1.9.0-Beta" +tools = "0.14.9-kotlin-1.9.0-RC-dev-1" +kotlin = "1.9.0-RC" atomicfu = "0.20.2" binary-compatibility-validator = "0.13.1" changelog = "2.0.0" @@ -8,12 +8,12 @@ dokka = "1.8.10" kotlin-jupyter = "0.11.0-360" kotlinx-benchmark = "0.4.7" kotlinx-cli = "0.3.5" -kotlinx-coroutines = "1.7.0-RC" +kotlinx-coroutines = "1.7.1" kotlinx-datetime = "0.4.0" kotlinx-html = "0.8.0" kotlinx-knit = "0.4.0" kotlinx-nodejs = "0.0.7" -kotlinx-serialization = "1.5.0" +kotlinx-serialization = "1.5.1" ktor = "2.3.0" xmlutil = "0.86.0" yamlkt = "0.13.0" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 44dde80..d317d9f 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -561,13 +561,6 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro configure(nativeTargets) { - //TODO remove after https://youtrack.jetbrains.com/issue/KT-58837 - compilations.configureEach { - compilerOptions.configure { - freeCompilerArgs.add("-Xpartial-linkage=disable") - } - } - compilations["main"]?.apply { configure(kotlinSourceSets) { dependsOn(nativeMain) -- 2.34.1 From 8a864f97a30247d2dd5418e291cde543635248af Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 7 Jul 2023 21:44:38 +0300 Subject: [PATCH 13/50] 1.9.0 --- CHANGELOG.md | 1 + gradle/libs.versions.toml | 6 +++--- .../space/kscience/gradle/KScienceExtension.kt | 9 +++++---- .../space/kscience/gradle/KScienceProjectPlugin.kt | 1 - src/main/resources/templates/ARTIFACT-TEMPLATE.md | 13 ++----------- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b41fce7..a46c808 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deprecated ### Removed +- Groovy gradle dependency notation. ### Fixed diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ce4862f..7274cfe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.14.9-kotlin-1.9.0-RC-dev-1" -kotlin = "1.9.0-RC" +tools = "0.14.9-kotlin-1.9.0" +kotlin = "1.9.0" atomicfu = "0.20.2" binary-compatibility-validator = "0.13.1" changelog = "2.0.0" @@ -8,7 +8,7 @@ dokka = "1.8.10" kotlin-jupyter = "0.11.0-360" kotlinx-benchmark = "0.4.7" kotlinx-cli = "0.3.5" -kotlinx-coroutines = "1.7.1" +kotlinx-coroutines = "1.7.2" kotlinx-datetime = "0.4.0" kotlinx-html = "0.8.0" kotlinx-knit = "0.4.0" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 0762650..6e6f2df 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -1,5 +1,6 @@ package space.kscience.gradle +import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.plugins.ApplicationPlugin @@ -434,13 +435,13 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.configure { wasm { browser { - testTask { + testTask(Action { useKarma { this.webpackConfig.experiments.add("topLevelAwait") useChromeHeadlessWasmGc() useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) } - } + }) } block() } @@ -473,9 +474,9 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro js { binaries.executable() browser { - webpackTask { + webpackTask(Action { mainOutputFileName.set(bundleName) - } + }) browserConfig() } jsConfig() diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index 4e1dda3..fded38d 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -142,7 +142,6 @@ public open class KScienceProjectPlugin : Plugin { val readmeExtension = KScienceReadmeExtension(this) extensions.add("readme", readmeExtension) - @Suppress("UNUSED_VARIABLE") val generateReadme by tasks.creating { group = "documentation" description = "Generate a README file if stub is present" diff --git a/src/main/resources/templates/ARTIFACT-TEMPLATE.md b/src/main/resources/templates/ARTIFACT-TEMPLATE.md index 4f04b4d..eeb5d05 100644 --- a/src/main/resources/templates/ARTIFACT-TEMPLATE.md +++ b/src/main/resources/templates/ARTIFACT-TEMPLATE.md @@ -2,21 +2,12 @@ The Maven coordinates of this project are `${group}:${name}:${version}`. -**Gradle Groovy:** -```groovy -repositories { - maven { url 'https://repo.kotlin.link' } - mavenCentral() -} - -dependencies { - implementation '${group}:${name}:${version}' -} -``` **Gradle Kotlin DSL:** ```kotlin repositories { maven("https://repo.kotlin.link") + //uncomment to access development builds + //maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev") mavenCentral() } -- 2.34.1 From c249dc5ae4924b8500d8084f22ce3268c23b18b0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 21 Aug 2023 18:26:17 +0300 Subject: [PATCH 14/50] 1.9.0 --- gradle/libs.versions.toml | 26 +++++++++---------- .../kscience/gradle/KScienceProjectPlugin.kt | 21 ++++++++------- .../gradle/KScienceReadmeExtension.kt | 11 ++++++-- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7274cfe..8103a9f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,25 +1,25 @@ [versions] -tools = "0.14.9-kotlin-1.9.0" +tools = "0.14.10-kotlin-1.9.0" kotlin = "1.9.0" -atomicfu = "0.20.2" -binary-compatibility-validator = "0.13.1" -changelog = "2.0.0" -dokka = "1.8.10" -kotlin-jupyter = "0.11.0-360" -kotlinx-benchmark = "0.4.7" +atomicfu = "0.22.0" +binary-compatibility-validator = "0.13.2" +changelog = "2.1.2" +dokka = "1.8.20" +kotlin-jupyter = "0.12.0-43" +kotlinx-benchmark = "0.4.9" kotlinx-cli = "0.3.5" -kotlinx-coroutines = "1.7.2" +kotlinx-coroutines = "1.7.3" kotlinx-datetime = "0.4.0" -kotlinx-html = "0.8.0" +kotlinx-html = "0.9.1" kotlinx-knit = "0.4.0" kotlinx-nodejs = "0.0.7" kotlinx-serialization = "1.5.1" -ktor = "2.3.0" -xmlutil = "0.86.0" +ktor = "2.3.3" +xmlutil = "0.86.1" yamlkt = "0.13.0" -jsBom = "1.0.0-pre.546" +jsBom = "1.0.0-pre.618" junit = "5.9.3" -compose = "1.4.0" +compose = "1.5.0-rc01" logback = "1.4.7" [libraries] diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index fded38d..3257e82 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -205,17 +205,18 @@ public open class KScienceProjectPlugin : Plugin { val modulesString = buildString { subprojects.forEach { subproject -> // val name = subproject.name - subproject.extensions.findByType()?.let { ext -> - val path = subproject.path.replaceFirst(":", "").replace(":", "/") - appendLine("\n### [$path]($path)") - appendLine("> ${ext.description}") - appendLine(">\n> **Maturity**: ${ext.maturity}") - val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/") - if (featureString.isNotBlank()) { - appendLine(">\n> **Features:**") - appendLine(featureString) + subproject.extensions.findByType() + ?.let { ext: KScienceReadmeExtension -> + val path = subproject.path.replaceFirst(":", "").replace(":", "/") + appendLine("\n### [$path]($path)") + ext.description?.let { appendLine("> ${ext.description}") } + appendLine(">\n> **Maturity**: ${ext.maturity}") + val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/") + if (featureString.isNotBlank()) { + appendLine(">\n> **Features:**") + appendLine(featureString) + } } - } } } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt index a63fa26..af16822 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt @@ -10,6 +10,7 @@ import kotlinx.html.stream.createHTML import kotlinx.validation.ApiValidationExtension import org.gradle.api.Project import org.gradle.kotlin.dsl.findByType +import org.intellij.lang.annotations.Language import java.io.File import java.io.StringWriter import kotlin.collections.component1 @@ -32,7 +33,8 @@ private fun Template.processToString(args: Map): String { public class KScienceReadmeExtension(public val project: Project) { - public var description: String = project.description ?: "" + public var description: String? = null + get() = field ?: project.description public var maturity: Maturity = Maturity.EXPERIMENTAL set(value) { @@ -93,7 +95,12 @@ public class KScienceReadmeExtension(public val project: Project) { /** * A plain readme feature with description */ - public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) { + public fun feature( + id: String, + @Language("File") ref: String? = null, + name: String = id, + description: () -> String, + ) { features += Feature(id, description(), ref, name) } -- 2.34.1 From c3bdd8edca5e4ea932e55a662432c97a325af0f0 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 12 Sep 2023 08:48:25 +0300 Subject: [PATCH 15/50] update versions --- gradle/libs.versions.toml | 47 +++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8103a9f..0a7ccc2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,26 +1,47 @@ [versions] -tools = "0.14.10-kotlin-1.9.0" -kotlin = "1.9.0" +tools = "0.14.11-kotlin-1.9.20-Beta" +kotlin = "1.9.20-Beta" +# https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" +# https://github.com/Kotlin/binary-compatibility-validator binary-compatibility-validator = "0.13.2" -changelog = "2.1.2" -dokka = "1.8.20" -kotlin-jupyter = "0.12.0-43" +# https://github.com/JetBrains/gradle-changelog-plugin +changelog = "2.2.0" +# https://github.com/Kotlin/dokka +dokka = "1.9.0" +# https://github.com/Kotlin/kotlin-jupyter +kotlin-jupyter = "0.12.0-56" +# https://github.com/Kotlin/kotlinx-benchmark kotlinx-benchmark = "0.4.9" -kotlinx-cli = "0.3.5" +# https://github.com/Kotlin/kotlinx-cli +kotlinx-cli = "0.3.6" +# https://github.com/Kotlin/kotlinx.coroutines kotlinx-coroutines = "1.7.3" -kotlinx-datetime = "0.4.0" +# https://github.com/Kotlin/kotlinx-datetime +kotlinx-datetime = "0.4.1" +# https://github.com/Kotlin/kotlinx.html kotlinx-html = "0.9.1" +# https://github.com/Kotlin/kotlinx-knit kotlinx-knit = "0.4.0" +# https://github.com/Kotlin/kotlinx-nodejs kotlinx-nodejs = "0.0.7" -kotlinx-serialization = "1.5.1" -ktor = "2.3.3" +# https://github.com/Kotlin/kotlinx.serialization +kotlinx-serialization = "1.6.0" +# https://ktor.io/ +ktor = "2.3.4" +# https://github.com/pdvrieze/xmlutil xmlutil = "0.86.1" +# https://github.com/Him188/yamlkt yamlkt = "0.13.0" -jsBom = "1.0.0-pre.618" +# https://github.com/JetBrains/kotlin-wrappers +jsBom = "1.0.0-pre.624" junit = "5.9.3" -compose = "1.5.0-rc01" -logback = "1.4.7" +# https://github.com/JetBrains/compose-multiplatform +compose = "1.5.1" +# https://mvnrepository.com/artifact/org.slf4j/slf4j-api +slf4j = "2.0.9" +# https://mvnrepository.com/artifact/ch.qos.logback/logback-classic +logback = "1.4.11" [libraries] atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } @@ -81,6 +102,8 @@ xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", v yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } +slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } + logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } [plugins] -- 2.34.1 From 2f5e053aeaca7dcf0b411da40956f6bf5a5506cc Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 12 Sep 2023 21:04:29 +0300 Subject: [PATCH 16/50] Change publishing logic. Adjust to adhere to gradle 8.3 changes. --- build.gradle.kts | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- .../kscience/gradle/KScienceExtension.kt | 33 ++++--- .../kscience/gradle/KScienceProjectPlugin.kt | 50 ++++------- .../kscience/gradle/internal/publishing.kt | 86 ++++--------------- 5 files changed, 52 insertions(+), 125 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7924869..d18454a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -76,12 +76,12 @@ gradlePlugin { tasks.create("version") { group = "publishing" - val versionFile = project.buildDir.resolve("project-version.txt") - outputs.file(versionFile) + val versionFileProvider = project.layout.buildDirectory.file("project-version.txt") + outputs.file(versionFileProvider) doLast { + val versionFile = versionFileProvider.get().asFile versionFile.createNewFile() versionFile.writeText(project.version.toString()) - println(project.version) } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fae0804..db9a6b8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 6e6f2df..b362595 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -17,10 +17,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl -import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl -import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl -import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmTargetDsl +import org.jetbrains.kotlin.gradle.targets.js.dsl.* import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask @@ -108,7 +105,7 @@ public open class KScienceExtension(public val project: Project) { configure { sourceSets.findByName("commonMain")?.apply { dependencies { - api(platform("io.ktor:ktor-bom:$version")) + api(project.dependencies.platform("io.ktor:ktor-bom:$version")) } } } @@ -117,7 +114,7 @@ public open class KScienceExtension(public val project: Project) { configure { sourceSets.findByName("main")?.apply { dependencies { - api(platform("io.ktor:ktor-bom:$version")) + api(project.dependencies.platform("io.ktor:ktor-bom:$version")) } } } @@ -126,7 +123,7 @@ public open class KScienceExtension(public val project: Project) { configure { sourceSets.findByName("main")?.apply { dependencies { - api(platform("io.ktor:ktor-bom:$version")) + api(project.dependencies.platform("io.ktor:ktor-bom:$version")) } } } @@ -235,7 +232,7 @@ public open class KScienceExtension(public val project: Project) { binaries.executable() } - targets.withType { + targets.withType { binaries.executable() } } @@ -265,8 +262,8 @@ public open class KScienceExtension(public val project: Project) { public val jsTest: DefaultSourceSet get() = DefaultSourceSet("jsTest") public val nativeMain: DefaultSourceSet get() = DefaultSourceSet("nativeMain") public val nativeTest: DefaultSourceSet get() = DefaultSourceSet("nativeTest") - public val wasmMain: DefaultSourceSet get() = DefaultSourceSet("wasmMain") - public val wasmTest: DefaultSourceSet get() = DefaultSourceSet("wasmTest") + public val wasmJsMain: DefaultSourceSet get() = DefaultSourceSet("wasmJsMain") + public val wasmJsTest: DefaultSourceSet get() = DefaultSourceSet("wasmJsTest") } @@ -426,27 +423,27 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro @OptIn(ExperimentalWasmDsl::class) public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { - if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { - project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") - return - } +// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { +// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") +// return +// } project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { - wasm { + wasmJs { browser { - testTask(Action { + testTask { useKarma { this.webpackConfig.experiments.add("topLevelAwait") useChromeHeadlessWasmGc() useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) } - }) + } } block() } sourceSets { - getByName("wasmTest") { + getByName("wasmJsTest") { dependencies { implementation(kotlin("test")) } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index 3257e82..a613654 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -15,7 +15,9 @@ import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension -import space.kscience.gradle.internal.* +import space.kscience.gradle.internal.addPublishing +import space.kscience.gradle.internal.addSonatypePublishing +import space.kscience.gradle.internal.setupPublication /** * Simplifies adding repositories for Maven publishing, responds for releasing tasks for projects. @@ -54,42 +56,20 @@ public class KSciencePublishingExtension(public val project: Project) { } /** - * Adds GitHub as VCS and adds GitHub Packages Maven repository to publishing. - * - * @param githubProject the GitHub project. - * @param githubOrg the GitHub user or organization. - * @param deploy publish packages in the `deploy` task to the GitHub repository. + * Add a repository with [repositoryName]. Uses "publishing.$repositoryName.user" and "publishing.$repositoryName.token" + * properties pattern to store user and token */ - public fun github( - githubOrg: String, - githubProject: String, - deploy: Boolean = project.requestPropertyOrNull("publishing.github") == "true", + public fun repository( + repositoryName: String, + url: String, ) { - if (deploy) { - try { - project.addGithubPublishing(githubOrg, githubProject) - } catch (t: Throwable) { - project.logger.error("Failed to set up github publication", t) - } - } - } - - /** - * Adds Space Packages Maven repository to publishing. - * - * @param spaceRepo the repository URL. - * @param deploy publish packages in the `deploy` task to the Space repository. - */ - public fun space( - spaceRepo: String, - ) { - project.addSpacePublishing(spaceRepo) + require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" } + project.addPublishing(repositoryName, url) } /** * Adds Sonatype Maven repository to publishing. - * - * @param addToRelease publish packages in the `release` task to the Sonatype repository. + */ public fun sonatype(sonatypeRoot: String = "https://s01.oss.sonatype.org") { require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" } @@ -142,7 +122,7 @@ public open class KScienceProjectPlugin : Plugin { val readmeExtension = KScienceReadmeExtension(this) extensions.add("readme", readmeExtension) - val generateReadme by tasks.creating { + tasks.create("generateReadme") { group = "documentation" description = "Generate a README file if stub is present" @@ -236,12 +216,12 @@ public open class KScienceProjectPlugin : Plugin { tasks.create("version") { group = "publishing" - val versionFile = project.buildDir.resolve("project-version.txt") - outputs.file(versionFile) + val versionFileProvider = project.layout.buildDirectory.file("project-version.txt") + outputs.file(versionFileProvider) doLast { + val versionFile = versionFileProvider.get().asFile versionFile.createNewFile() versionFile.writeText(project.version.toString()) - println(project.version) } } diff --git a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt index ae247d1..f9e3483 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt @@ -46,7 +46,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit } publications.create("jvm") { - kotlin.target.components.forEach { + project.components.forEach { from(it) } @@ -91,7 +91,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit val signingKey: String = requestProperty("publishing.signing.key") val signingPassphrase: String = requestProperty("publishing.signing.passPhrase") - // if key is provided, use it + // if a key is provided, use it useInMemoryPgpKeys(signingId, signingKey, signingPassphrase) } // else use agent signing sign(publications) @@ -103,30 +103,31 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit } } -internal fun Project.addGithubPublishing( - githubOrg: String, - githubProject: String, -) { - val githubUser: String? = requestPropertyOrNull("publishing.github.user") - val githubToken: String? = requestPropertyOrNull("publishing.github.token") +internal fun Project.addPublishing( + repositoryName: String, + urlString:String +){ + require(repositoryName.matches("\\w*".toRegex())){"Repository name must contain only letters or numbers"} + val user: String? = requestPropertyOrNull("publishing.$repositoryName.user") + val token: String? = requestPropertyOrNull("publishing.$repositoryName.token") - if (githubUser == null || githubToken == null) { - logger.info("Skipping Github publishing because Github credentials are not defined") + if (user == null || token == null) { + logger.info("Skipping $repositoryName publishing because $repositoryName credentials are not defined") return } allprojects { plugins.withId("maven-publish") { configure { - logger.info("Adding Github publishing to project [${project.name}]") + logger.info("Adding $repositoryName publishing to project [${project.name}]") repositories.maven { - name = "github" - url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/") + name = repositoryName + url = uri(urlString) credentials { - username = githubUser - password = githubToken + username = user + password = token } } } @@ -134,62 +135,11 @@ internal fun Project.addGithubPublishing( } } -internal fun Project.addSpacePublishing(spaceRepo: String) { - val spaceUser: String? = requestPropertyOrNull("publishing.space.user") - val spaceToken: String? = requestPropertyOrNull("publishing.space.token") - - if (spaceUser == null || spaceToken == null) { - logger.info("Skipping Space publishing because Space credentials are not defined") - return - } - - allprojects { - plugins.withId("maven-publish") { - configure { - project.logger.info("Adding SPC Space publishing to project [${project.name}]") - - repositories.maven { - name = "space" - url = uri(spaceRepo) - - credentials { - username = spaceUser - password = spaceToken - } - } - } - } - } -} internal fun Project.addSonatypePublishing(sonatypeRoot: String) { if (isInDevelopment) { logger.info("Sonatype publishing skipped for development version") - return - } - - val sonatypeUser: String? = requestPropertyOrNull("publishing.sonatype.user") - val sonatypePassword: String? = requestPropertyOrNull("publishing.sonatype.password") - - if (sonatypeUser == null || sonatypePassword == null) { - logger.info("Skipping Sonatype publishing because Sonatype credentials are not defined") - return - } - - allprojects { - plugins.withId("maven-publish") { - configure { - repositories.maven { - val sonatypeRepo = "$sonatypeRoot/service/local/staging/deploy/maven2" - name = "sonatype" - url = uri(sonatypeRepo) - - credentials { - username = sonatypeUser - password = sonatypePassword - } - } - } - } + } else { + addPublishing("sonatype", "$sonatypeRoot/service/local/staging/deploy/maven2") } } -- 2.34.1 From 33b6de9f0eaec72b63707eb5785acebc35c7aed2 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 12 Sep 2023 21:19:05 +0300 Subject: [PATCH 17/50] Change plugin deploy logic --- build.gradle.kts | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d18454a..4dde05e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -117,7 +117,7 @@ val emptySourcesJar by tasks.creating(Jar::class) { } publishing { - val vcs = "https://github.com/mipt-npm/gradle-tools" + val vcs = "https://github.com/SciProgCentre/gradle-tools" // Process each publication we have in this project publications { @@ -151,10 +151,10 @@ publishing { developers { developer { - id.set("MIPT-NPM") - name.set("MIPT nuclear physics methods laboratory") - organization.set("MIPT") - organizationUrl.set("https://npm.mipt.ru") + id.set("SPC") + name.set("Scientific Programming Centre") + organization.set("SPC") + organizationUrl.set("https://sciprog.center/") } } @@ -166,20 +166,18 @@ publishing { } } - val spaceRepo = "https://maven.pkg.jetbrains.space/spc/p/sci/maven" - val spaceUser: String? = findProperty("publishing.space.user") as? String - val spaceToken: String? = findProperty("publishing.space.token") as? String - - if (spaceUser != null && spaceToken != null) { - project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]") + val spaceRepo = "https://maven.sciprog.center/kscience" + val spcUser: String? = findProperty("publishing.spc.user") as? String + val spcToken: String? = findProperty("publishing.spc.token") as? String + if (spcUser != null && spcToken != null) { repositories.maven { - name = "space" + name = "spc" url = uri(spaceRepo) credentials { - username = spaceUser - password = spaceToken + username = spcUser + password = spcToken } } } -- 2.34.1 From 4f41d903082525811fec8d50bf63463aff9d8e07 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 13 Sep 2023 08:52:23 +0300 Subject: [PATCH 18/50] Update changelog and version --- CHANGELOG.md | 3 ++ gradle/libs.versions.toml | 2 +- .../kscience/gradle/KScienceExtension.kt | 36 +------------------ 3 files changed, 5 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a46c808..144034a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add development mode for fullstack. ### Changed +- Kotlin 1.9.20 +- Remove publishing defaults for Space and GitHub. Now publishing repositories is configured quasi-manually. Property keys for username and tokens are generated automatically. - All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. ### Deprecated ### Removed +- Unnecessary `dependsOn` for native dependencies. - Groovy gradle dependency notation. ### Fixed diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a7ccc2..f7c5f1c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -tools = "0.14.11-kotlin-1.9.20-Beta" +tools = "0.15.0-kotlin-1.9.20-Beta" kotlin = "1.9.20-Beta" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index b362595..3680e50 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -503,8 +503,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro val nativeConfiguration = KScienceNativeConfiguration(this).apply(block) pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { configure { - val nativeTargets: List = - nativeConfiguration.targets.values.map { nativeTarget -> + nativeConfiguration.targets.values.forEach { nativeTarget -> when (nativeTarget.preset) { KotlinNativePreset.linuxX64 -> linuxX64( nativeTarget.targetName, @@ -540,42 +539,9 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro nativeTarget.targetName, nativeTarget.targetConfiguration ) - -// else -> { -// logger.error("Native preset ${nativeTarget.preset} not recognised.") -// null -// } } } - sourceSets { - val commonMain by getting - val commonTest by getting - - val nativeMain by creating { - dependsOn(commonMain) - } - - val nativeTest by creating { - //should NOT depend on nativeMain because automatic dependency by plugin - dependsOn(commonTest) - } - - configure(nativeTargets) { - - compilations["main"]?.apply { - configure(kotlinSourceSets) { - dependsOn(nativeMain) - } - } - - compilations["test"]?.apply { - configure(kotlinSourceSets) { - dependsOn(nativeTest) - } - } - } - } } } } -- 2.34.1 From b27624bf1cdea951c60544a0a4260e144e9b07d4 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 13 Sep 2023 12:12:46 +0300 Subject: [PATCH 19/50] remove Js plugin and deprecated JVM --- CHANGELOG.md | 2 + build.gradle.kts | 6 -- .../kscience/gradle/KScienceExtension.kt | 66 +++++++++---------- .../space/kscience/gradle/KScienceJSPlugin.kt | 56 ---------------- .../kscience/gradle/KScienceJVMPlugin.kt | 12 ++-- .../space/kscience/gradle/internal/common.kt | 8 ++- .../kscience/gradle/internal/publishing.kt | 17 +---- 7 files changed, 47 insertions(+), 120 deletions(-) delete mode 100644 src/main/kotlin/space/kscience/gradle/KScienceJSPlugin.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 144034a..7021c06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. ### Deprecated +- JVM plugin in favor of Mpp. ### Removed +- JS plugin. It is deprecated in favor of MPP. - Unnecessary `dependsOn` for native dependencies. - Groovy gradle dependency notation. diff --git a/build.gradle.kts b/build.gradle.kts index 4dde05e..616260d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -65,12 +65,6 @@ gradlePlugin { description = "Pre-configured JVM project" implementationClass = "space.kscience.gradle.KScienceJVMPlugin" } - - create("js") { - id = "space.kscience.gradle.js" - description = "Pre-configured JS project" - implementationClass = "space.kscience.gradle.KScienceJSPlugin" - } } } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 3680e50..3e04ae3 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -373,8 +373,8 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.configure { jvm { compilations.all { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs + compilerOptions { + freeCompilerArgs.addAll(defaultKotlinJvmArgs) } } block() @@ -503,44 +503,44 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro val nativeConfiguration = KScienceNativeConfiguration(this).apply(block) pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { configure { - nativeConfiguration.targets.values.forEach { nativeTarget -> - when (nativeTarget.preset) { - KotlinNativePreset.linuxX64 -> linuxX64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) + nativeConfiguration.targets.values.forEach { nativeTarget -> + when (nativeTarget.preset) { + KotlinNativePreset.linuxX64 -> linuxX64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) - KotlinNativePreset.mingwX64 -> mingwX64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) + KotlinNativePreset.mingwX64 -> mingwX64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) - KotlinNativePreset.macosX64 -> macosX64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) + KotlinNativePreset.macosX64 -> macosX64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) - KotlinNativePreset.macosArm64 -> macosArm64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) + KotlinNativePreset.macosArm64 -> macosArm64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) - KotlinNativePreset.iosX64 -> iosX64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) + KotlinNativePreset.iosX64 -> iosX64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) - KotlinNativePreset.iosArm64 -> iosArm64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) + KotlinNativePreset.iosArm64 -> iosArm64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) - KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64( - nativeTarget.targetName, - nativeTarget.targetConfiguration - ) - } + KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64( + nativeTarget.targetName, + nativeTarget.targetConfiguration + ) } + } } } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceJSPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceJSPlugin.kt deleted file mode 100644 index 0610cd3..0000000 --- a/src/main/kotlin/space/kscience/gradle/KScienceJSPlugin.kt +++ /dev/null @@ -1,56 +0,0 @@ -package space.kscience.gradle - -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.tasks.Copy -import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.get -import org.jetbrains.dokka.gradle.DokkaPlugin -import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension -import space.kscience.gradle.internal.applySettings -import space.kscience.gradle.internal.fromJsDependencies - -public open class KScienceJSPlugin : Plugin { - override fun apply(project: Project): Unit = project.run { - if (!plugins.hasPlugin("org.jetbrains.kotlin.js")) { - plugins.apply("org.jetbrains.kotlin.js") - } else { - logger.info("Kotlin JS plugin is already present") - } - registerKScienceExtension(::KScienceExtension) - - //logger.info("Applying KScience configuration for JS project") - configure { - js(IR) { browser { } } - - sourceSets.all { - languageSettings.applySettings() - } - - sourceSets["main"].apply { - dependencies { - api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}")) - } - } - - sourceSets["test"].apply { - dependencies { - implementation(kotlin("test-js")) - } - } - - if (explicitApi == null) explicitApiWarning() - } - - (tasks.findByName("processResources") as? Copy)?.apply { - fromJsDependencies("runtimeClasspath") - } - - - // apply dokka for all projects - if (!plugins.hasPlugin("org.jetbrains.dokka")) { - apply() - } - } -} diff --git a/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt index 168297b..4cd7f56 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt @@ -10,12 +10,13 @@ import org.gradle.kotlin.dsl.get import org.gradle.kotlin.dsl.withType import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import space.kscience.gradle.internal.applySettings import space.kscience.gradle.internal.defaultKotlinJvmArgs public open class KScienceJVMPlugin : Plugin { override fun apply(project: Project): Unit = project.run { + + logger.warn("KSCience JVM plugin is deprecated. Use MPP.") if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) { plugins.apply("org.jetbrains.kotlin.jvm") } else { @@ -27,6 +28,9 @@ public open class KScienceJVMPlugin : Plugin { configure { sourceSets.all { languageSettings.applySettings() + compilerOptions{ + freeCompilerArgs.addAll(defaultKotlinJvmArgs) + } } sourceSets["test"].apply { @@ -42,12 +46,6 @@ public open class KScienceJVMPlugin : Plugin { } } - tasks.withType { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs - } - } - tasks.withType { useJUnitPlatform() } diff --git a/src/main/kotlin/space/kscience/gradle/internal/common.kt b/src/main/kotlin/space/kscience/gradle/internal/common.kt index 0979bd2..096e0a2 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/common.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/common.kt @@ -7,8 +7,11 @@ import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder import space.kscience.gradle.KScienceVersions -internal val defaultKotlinJvmArgs: List = - listOf("-Xjvm-default=all", "-Xlambdas=indy"/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/) +internal val defaultKotlinJvmArgs: List = listOf( + "-Xjvm-default=all", + "-Xlambdas=indy", + /* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/ +) internal fun resolveKotlinVersion(): KotlinVersion { val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-") @@ -23,6 +26,7 @@ internal fun LanguageSettingsBuilder.applySettings( apiVersion = versionString progressiveMode = true + optIn("kotlin.RequiresOptIn") optIn("kotlin.ExperimentalUnsignedTypes") optIn("kotlin.ExperimentalStdlibApi") diff --git a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt index f9e3483..3b94276 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/publishing.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/publishing.kt @@ -8,9 +8,7 @@ import org.gradle.api.tasks.bundling.Jar import org.gradle.kotlin.dsl.* import org.gradle.plugins.signing.SigningExtension import org.gradle.plugins.signing.SigningPlugin -import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension -import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets import space.kscience.gradle.isInDevelopment internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String @@ -24,17 +22,6 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit plugins.withId("maven-publish") { configure { - plugins.withId("org.jetbrains.kotlin.js") { - val kotlin: KotlinJsProjectExtension = extensions.findByType()!! - - publications.create("js") { - kotlin.targets.flatMap { it.components }.forEach { - from(it) - } - } - - } - plugins.withId("org.jetbrains.kotlin.jvm") { val kotlin = extensions.findByType()!! @@ -46,9 +33,7 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit } publications.create("jvm") { - project.components.forEach { - from(it) - } + from(project.components["java"]) artifact(sourcesJar) } -- 2.34.1 From 89af2dd644ea1a6580ea11e06cbf3b53773de3c9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Fri, 22 Sep 2023 08:43:01 +0300 Subject: [PATCH 20/50] bump version --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f7c5f1c..c6ba410 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.0-kotlin-1.9.20-Beta" -kotlin = "1.9.20-Beta" +tools = "0.15.0-kotlin-1.9.20-Beta2" +kotlin = "1.9.20-Beta2" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" # https://github.com/Kotlin/binary-compatibility-validator -- 2.34.1 From 54952c3da67d9f1c29e044e2bd966314c60a1a03 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 18 Oct 2023 11:27:37 +0300 Subject: [PATCH 21/50] Update to 1.9.20-RC. Fix warnings --- build.gradle.kts | 1 + gradle/libs.versions.toml | 4 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../kscience/gradle/KScienceExtension.kt | 28 +++++++++---------- .../space/kscience/gradle/KScienceMPPlugin.kt | 17 +++++++---- .../space/kscience/gradle/internal/common.kt | 4 +++ 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 616260d..e9a7bc3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,6 +25,7 @@ kotlin.explicitApiWarning() dependencies { api(libs.kotlin.gradle) + api("org.gradle.toolchains:foojay-resolver:0.7.0") implementation(libs.binary.compatibility.validator) implementation(libs.changelog.gradle) implementation(libs.dokka.gradle) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c6ba410..a01b656 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.0-kotlin-1.9.20-Beta2" -kotlin = "1.9.20-Beta2" +tools = "0.15.0-kotlin-1.9.20-RC" +kotlin = "1.9.20-RC" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" # https://github.com/Kotlin/binary-compatibility-validator diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db9a6b8..e411586 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 3e04ae3..db82c59 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -1,6 +1,5 @@ package space.kscience.gradle -import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.plugins.ApplicationPlugin @@ -17,7 +16,10 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget -import org.jetbrains.kotlin.gradle.targets.js.dsl.* +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl +import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl +import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask @@ -179,13 +181,6 @@ public open class KScienceExtension(public val project: Project) { } } - project.pluginManager.withPlugin("org.jetbrains.kotlin.js") { - project.configure { - sourceSets.getByName(sourceSet ?: "test") { - dependencies(dependencyBlock) - } - } - } project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { @@ -373,7 +368,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.configure { jvm { compilations.all { - compilerOptions { + compilerOptions.configure { freeCompilerArgs.addAll(defaultKotlinJvmArgs) } } @@ -421,8 +416,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro } } + /** + * Add Wasm/Js target + */ @OptIn(ExperimentalWasmDsl::class) - public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { + public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) { // if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { // project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") // return @@ -434,7 +432,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro browser { testTask { useKarma { - this.webpackConfig.experiments.add("topLevelAwait") + webpackConfig.experiments.add("topLevelAwait") useChromeHeadlessWasmGc() useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) } @@ -469,14 +467,14 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro browserConfig: KotlinJsBrowserDsl.() -> Unit = {}, ) { js { - binaries.executable() browser { - webpackTask(Action { + webpackTask { mainOutputFileName.set(bundleName) - }) + } browserConfig() } jsConfig() + binaries.executable() } jvm { val processResourcesTaskName = diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index cb02302..72858c1 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -10,6 +10,7 @@ import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin import space.kscience.gradle.internal.applySettings +import space.kscience.gradle.internal.defaultKotlinCommonArgs public open class KScienceMPPlugin : Plugin { override fun apply(project: Project): Unit = project.run { @@ -23,23 +24,29 @@ public open class KScienceMPPlugin : Plugin { registerKScienceExtension(::KScienceMppExtension) configure { - sourceSets { - getByName("commonMain"){ + getByName("commonMain") { dependencies { api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}")) } } - getByName("commonTest"){ + getByName("commonTest") { dependencies { implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) } } + all { + languageSettings.applySettings() + } } - sourceSets.all { - languageSettings.applySettings() + targets.all { + compilations.all { + kotlinOptions{ + freeCompilerArgs += defaultKotlinCommonArgs + } + } } if (explicitApi == null) explicitApiWarning() diff --git a/src/main/kotlin/space/kscience/gradle/internal/common.kt b/src/main/kotlin/space/kscience/gradle/internal/common.kt index 096e0a2..1008006 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/common.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/common.kt @@ -13,6 +13,10 @@ internal val defaultKotlinJvmArgs: List = listOf( /* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/ ) +internal val defaultKotlinCommonArgs: List = listOf( + "-Xexpect-actual-classes" +) + internal fun resolveKotlinVersion(): KotlinVersion { val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-") return KotlinVersion(major.toInt(), minor.toInt(), patch.toInt()) -- 2.34.1 From 90762f493ef05c97f8fbd2f278a8e569c99bbd1e Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 25 Oct 2023 08:44:47 +0300 Subject: [PATCH 22/50] Update to 1.9.20-RC2 --- gradle/libs.versions.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a01b656..909d837 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.0-kotlin-1.9.20-RC" -kotlin = "1.9.20-RC" +tools = "0.15.0-kotlin-1.9.20-RC2" +kotlin = "1.9.20-RC2" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" # https://github.com/Kotlin/binary-compatibility-validator @@ -8,9 +8,9 @@ binary-compatibility-validator = "0.13.2" # https://github.com/JetBrains/gradle-changelog-plugin changelog = "2.2.0" # https://github.com/Kotlin/dokka -dokka = "1.9.0" +dokka = "1.9.10" # https://github.com/Kotlin/kotlin-jupyter -kotlin-jupyter = "0.12.0-56" +kotlin-jupyter = "0.12.0-78" # https://github.com/Kotlin/kotlinx-benchmark kotlinx-benchmark = "0.4.9" # https://github.com/Kotlin/kotlinx-cli @@ -28,7 +28,7 @@ kotlinx-nodejs = "0.0.7" # https://github.com/Kotlin/kotlinx.serialization kotlinx-serialization = "1.6.0" # https://ktor.io/ -ktor = "2.3.4" +ktor = "2.3.5" # https://github.com/pdvrieze/xmlutil xmlutil = "0.86.1" # https://github.com/Him188/yamlkt @@ -37,7 +37,7 @@ yamlkt = "0.13.0" jsBom = "1.0.0-pre.624" junit = "5.9.3" # https://github.com/JetBrains/compose-multiplatform -compose = "1.5.1" +compose = "1.5.3" # https://mvnrepository.com/artifact/org.slf4j/slf4j-api slf4j = "2.0.9" # https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -- 2.34.1 From dba45860f79f91fed3289c2267d614945bb87f54 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 31 Oct 2023 13:59:09 +0300 Subject: [PATCH 23/50] Finalization for 1.9.20 --- gradle/libs.versions.toml | 6 +++--- src/main/kotlin/space/kscience/gradle/KScienceExtension.kt | 6 ++---- src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 909d837..754f7d5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.0-kotlin-1.9.20-RC2" -kotlin = "1.9.20-RC2" +tools = "0.15.0-kotlin-1.9.20" +kotlin = "1.9.20" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" # https://github.com/Kotlin/binary-compatibility-validator @@ -10,7 +10,7 @@ changelog = "2.2.0" # https://github.com/Kotlin/dokka dokka = "1.9.10" # https://github.com/Kotlin/kotlin-jupyter -kotlin-jupyter = "0.12.0-78" +kotlin-jupyter = "0.12.0-81" # https://github.com/Kotlin/kotlinx-benchmark kotlinx-benchmark = "0.4.9" # https://github.com/Kotlin/kotlinx-cli diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index db82c59..8a61f45 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -432,9 +432,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro browser { testTask { useKarma { - webpackConfig.experiments.add("topLevelAwait") - useChromeHeadlessWasmGc() - useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) + useChromeCanaryHeadless() } } } @@ -443,7 +441,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro sourceSets { getByName("wasmJsTest") { dependencies { - implementation(kotlin("test")) + implementation(kotlin("test-wasm-js")) } } } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index 72858c1..97d8d58 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -32,7 +32,7 @@ public open class KScienceMPPlugin : Plugin { } getByName("commonTest") { dependencies { - implementation(kotlin("test-common")) + implementation(kotlin("test")) implementation(kotlin("test-annotations-common")) } } -- 2.34.1 From b5772a2e9b4f72d7f2598a7ffc686faf50f12f2d Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 1 Nov 2023 09:03:49 +0300 Subject: [PATCH 24/50] Replace Chrom canary with chrome for wasm tests --- src/main/kotlin/space/kscience/gradle/KScienceExtension.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 8a61f45..8126af9 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -432,7 +432,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro browser { testTask { useKarma { - useChromeCanaryHeadless() + useChromeHeadless() } } } -- 2.34.1 From 7636f37cfcff20a8c301d20220f77a56bfce372d Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 1 Nov 2023 20:15:18 +0300 Subject: [PATCH 25/50] add foojay resolver --- settings.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index c4a5192..c16070c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,5 @@ rootProject.name = "gradle-tools" + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0") +} -- 2.34.1 From ed5faa0335efe6de6c623f3623f2e252aaa35f1b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 21 Nov 2023 11:22:40 +0300 Subject: [PATCH 26/50] kotlin 2.0.0-Beta1 --- gradle/libs.versions.toml | 6 +++--- src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 754f7d5..879d05c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.0-kotlin-1.9.20" -kotlin = "1.9.20" +tools = "0.15.0-kotlin-2.0.0-Beta1" +kotlin = "2.0.0-Beta1" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" # https://github.com/Kotlin/binary-compatibility-validator @@ -37,7 +37,7 @@ yamlkt = "0.13.0" jsBom = "1.0.0-pre.624" junit = "5.9.3" # https://github.com/JetBrains/compose-multiplatform -compose = "1.5.3" +compose = "1.5.10" # https://mvnrepository.com/artifact/org.slf4j/slf4j-api slf4j = "2.0.9" # https://mvnrepository.com/artifact/ch.qos.logback/logback-classic diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index 97d8d58..080bfcc 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -4,17 +4,15 @@ import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.hasPlugin import org.gradle.kotlin.dsl.invoke import org.jetbrains.dokka.gradle.DokkaPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension -import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin import space.kscience.gradle.internal.applySettings import space.kscience.gradle.internal.defaultKotlinCommonArgs public open class KScienceMPPlugin : Plugin { override fun apply(project: Project): Unit = project.run { - if (!plugins.hasPlugin(KotlinMultiplatformPlugin::class)) { + if (!plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) { //apply() for some reason it does not work plugins.apply("org.jetbrains.kotlin.multiplatform") } else { -- 2.34.1 From 71f7698633a8d9591032308336a8225b5f0e65b5 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 26 Nov 2023 09:32:31 +0300 Subject: [PATCH 27/50] kotlin 1.9.21 --- gradle/libs.versions.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 754f7d5..eae9d79 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.0-kotlin-1.9.20" -kotlin = "1.9.20" +tools = "0.15.1-kotlin-1.9.21" +kotlin = "1.9.21" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.22.0" # https://github.com/Kotlin/binary-compatibility-validator @@ -10,7 +10,7 @@ changelog = "2.2.0" # https://github.com/Kotlin/dokka dokka = "1.9.10" # https://github.com/Kotlin/kotlin-jupyter -kotlin-jupyter = "0.12.0-81" +kotlin-jupyter = "0.12.0-93" # https://github.com/Kotlin/kotlinx-benchmark kotlinx-benchmark = "0.4.9" # https://github.com/Kotlin/kotlinx-cli @@ -26,18 +26,18 @@ kotlinx-knit = "0.4.0" # https://github.com/Kotlin/kotlinx-nodejs kotlinx-nodejs = "0.0.7" # https://github.com/Kotlin/kotlinx.serialization -kotlinx-serialization = "1.6.0" +kotlinx-serialization = "1.6.1" # https://ktor.io/ -ktor = "2.3.5" +ktor = "2.3.6" # https://github.com/pdvrieze/xmlutil -xmlutil = "0.86.1" +xmlutil = "0.86.2" # https://github.com/Him188/yamlkt yamlkt = "0.13.0" # https://github.com/JetBrains/kotlin-wrappers -jsBom = "1.0.0-pre.624" +jsBom = "1.0.0-pre.648" junit = "5.9.3" # https://github.com/JetBrains/compose-multiplatform -compose = "1.5.3" +compose = "1.5.11" # https://mvnrepository.com/artifact/org.slf4j/slf4j-api slf4j = "2.0.9" # https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -- 2.34.1 From 920385e13511e2d1b75b5371c9be6b2e39287bd6 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 5 Dec 2023 15:11:22 +0300 Subject: [PATCH 28/50] Add wasm essentials --- gradle/libs.versions.toml | 11 +++++++---- .../kotlin/space/kscience/gradle/KScienceExtension.kt | 10 +--------- src/main/resources/templates/ARTIFACT-TEMPLATE.md | 2 -- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eae9d79..3027487 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,8 @@ [versions] -tools = "0.15.1-kotlin-1.9.21" +tools = "0.15.2-kotlin-1.9.21" kotlin = "1.9.21" # https://github.com/Kotlin/kotlinx-atomicfu -atomicfu = "0.22.0" +atomicfu = "0.23.1" # https://github.com/Kotlin/binary-compatibility-validator binary-compatibility-validator = "0.13.2" # https://github.com/JetBrains/gradle-changelog-plugin @@ -16,7 +16,7 @@ kotlinx-benchmark = "0.4.9" # https://github.com/Kotlin/kotlinx-cli kotlinx-cli = "0.3.6" # https://github.com/Kotlin/kotlinx.coroutines -kotlinx-coroutines = "1.7.3" +kotlinx-coroutines = "1.8.0-RC" # https://github.com/Kotlin/kotlinx-datetime kotlinx-datetime = "0.4.1" # https://github.com/Kotlin/kotlinx.html @@ -26,7 +26,7 @@ kotlinx-knit = "0.4.0" # https://github.com/Kotlin/kotlinx-nodejs kotlinx-nodejs = "0.0.7" # https://github.com/Kotlin/kotlinx.serialization -kotlinx-serialization = "1.6.1" +kotlinx-serialization = "1.6.2" # https://ktor.io/ ktor = "2.3.6" # https://github.com/pdvrieze/xmlutil @@ -110,8 +110,11 @@ logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "lo changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + compose = { id = "org.jetbrains.compose", version.ref = "compose" } +ktor = {id = "io.ktor.plugin", version.ref = "ktor"} + gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" } gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 8126af9..45d4c8f 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -155,14 +155,6 @@ public open class KScienceExtension(public val project: Project) { } } - project.pluginManager.withPlugin("org.jetbrains.kotlin.js") { - project.configure { - sourceSets.getByName(sourceSet ?: "main") { - dependencies(dependencyBlock) - } - } - } - project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { sourceSets.getByName(sourceSet ?: "commonMain") { @@ -537,7 +529,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro ) } } - + applyDefaultHierarchyTemplate() } } } diff --git a/src/main/resources/templates/ARTIFACT-TEMPLATE.md b/src/main/resources/templates/ARTIFACT-TEMPLATE.md index eeb5d05..5d39742 100644 --- a/src/main/resources/templates/ARTIFACT-TEMPLATE.md +++ b/src/main/resources/templates/ARTIFACT-TEMPLATE.md @@ -6,8 +6,6 @@ The Maven coordinates of this project are `${group}:${name}:${version}`. ```kotlin repositories { maven("https://repo.kotlin.link") - //uncomment to access development builds - //maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev") mavenCentral() } -- 2.34.1 From 6cd7b572d6bf966ec5f6a11a82b452d78ed46728 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 17 Dec 2023 11:07:27 +0300 Subject: [PATCH 29/50] Kotlin 2.0.0-Beta2 --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dfc8a4e..b4e4229 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.2-kotlin-2.0.0-Beta1" -kotlin = "2.0.0-Beta1" +tools = "0.15.2-kotlin-2.0.0-Beta2" +kotlin = "2.0.0-Beta2" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.23.1" # https://github.com/Kotlin/binary-compatibility-validator -- 2.34.1 From d79453371efb56885af078e7da901b821fff83b8 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 4 Feb 2024 18:59:17 +0300 Subject: [PATCH 30/50] Kotlin 1.9.22 --- gradle/libs.versions.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3027487..49a58b3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.2-kotlin-1.9.21" -kotlin = "1.9.21" +tools = "0.15.2-kotlin-1.9.22" +kotlin = "1.9.22" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.23.1" # https://github.com/Kotlin/binary-compatibility-validator @@ -12,15 +12,15 @@ dokka = "1.9.10" # https://github.com/Kotlin/kotlin-jupyter kotlin-jupyter = "0.12.0-93" # https://github.com/Kotlin/kotlinx-benchmark -kotlinx-benchmark = "0.4.9" +kotlinx-benchmark = "0.4.10" # https://github.com/Kotlin/kotlinx-cli kotlinx-cli = "0.3.6" # https://github.com/Kotlin/kotlinx.coroutines -kotlinx-coroutines = "1.8.0-RC" +kotlinx-coroutines = "1.8.0-RC2" # https://github.com/Kotlin/kotlinx-datetime kotlinx-datetime = "0.4.1" # https://github.com/Kotlin/kotlinx.html -kotlinx-html = "0.9.1" +kotlinx-html = "0.11.0" # https://github.com/Kotlin/kotlinx-knit kotlinx-knit = "0.4.0" # https://github.com/Kotlin/kotlinx-nodejs @@ -28,16 +28,16 @@ kotlinx-nodejs = "0.0.7" # https://github.com/Kotlin/kotlinx.serialization kotlinx-serialization = "1.6.2" # https://ktor.io/ -ktor = "2.3.6" +ktor = "2.3.8" # https://github.com/pdvrieze/xmlutil xmlutil = "0.86.2" # https://github.com/Him188/yamlkt yamlkt = "0.13.0" # https://github.com/JetBrains/kotlin-wrappers -jsBom = "1.0.0-pre.648" +jsBom = "1.0.0-pre.693" junit = "5.9.3" # https://github.com/JetBrains/compose-multiplatform -compose = "1.5.11" +compose = "1.5.12" # https://mvnrepository.com/artifact/org.slf4j/slf4j-api slf4j = "2.0.9" # https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -- 2.34.1 From 2da966b1cd216622d452396ceff21b6462471531 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 10 Feb 2024 12:30:36 +0300 Subject: [PATCH 31/50] Kotlin 1.9.22 --- CHANGELOG.md | 82 +++++++++++++++++-- gradle/libs.versions.toml | 2 +- .../kscience/gradle/KScienceExtension.kt | 2 + 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7021c06..194f8f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,47 +1,66 @@ # Changelog -All notable changes to this project will be documented in this file. +All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased ### Added -- Add development mode for fullstack. ### Changed -- Kotlin 1.9.20 -- Remove publishing defaults for Space and GitHub. Now publishing repositories is configured quasi-manually. Property keys for username and tokens are generated automatically. -- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. +- Use ES6 modules by default in JS ### Deprecated -- JVM plugin in favor of Mpp. ### Removed -- JS plugin. It is deprecated in favor of MPP. -- Unnecessary `dependsOn` for native dependencies. -- Groovy gradle dependency notation. ### Fixed ### Security +## 0.15.2-kotlin-1.9.22 - 2024-02-09 + +### Added + +- Add development mode for fullstack. + +### Changed + +- Kotlin 1.9.20 +- Remove publishing defaults for Space and GitHub. Now publishing repositories is configured quasi-manually. Property keys for username and tokens are generated automatically. +- All publishing targets are enabled by default. Introduce `publishing.targets` variable to regulate what is added to the module. + +### Deprecated + +- JVM plugin in favor of Mpp. + +### Removed + +- JS plugin. It is deprecated in favor of MPP. +- Unnecessary `dependsOn` for native dependencies. +- Groovy gradle dependency notation. + ## 0.14.4-kotlin-1.8.20-RC - 2023-03-12 ### Added + - Easier dependency handling in `kscience` block - Customizable base jdk version ### Changed + - MPP does not use JVM and JS(IR) targets anymore. They could be turned manually via `js()`, `jvm()` or `fullStack()` - Signing is not applied if signingId is not provided ### Removed + - FX plugins - Unnecessary library shortcuts (html and datetime) - deploy/release tasks ### Fixed + - Gradle 8 compatibility - Dokka publication - issues with test sourcesets @@ -49,9 +68,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.13.4-kotlin-1.8.0 - 2022-12-31 ### Added + - Public `isInDevelopment` project flag ### Changed + - Require manual pom config for publications - Kotlin 1.8.0 - Versions update @@ -59,139 +80,172 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Moved `yarn.lock` to `gradle` directory ### Deprecated + - FX configuration ### Removed + - Xjdk-release flag because it is broken until https://youtrack.jetbrains.com/issue/KT-52823 - Use CSS loader in JS by default ## 0.11.6-kotlin-1.7.0 ### Changed + - Coroutines tests are applied only when explicit `useCoroutines` is used. ### Removed + - Atomicfu support inside the plugin ### Fixed + - Rollback coroutines to 1.6.1 ## 0.11.5-kotlin-1.7.0 ### Added + - Coroutine tests as default dependency for tests - Context receiver flag ### Changed + - Separate release tasks for each target - Kotlin 1.7.0 - Ktor 2.0.1 - ExplicitAPI does not override existing value ### Removed + - Ktor specific artifacts from version catalog ### Fixed + - Moved signing out of sonatype block ## 0.11.1-kotlin-1.6.10 ### Added + - Default templates for README and ARTIFACT ### Changed + - Replaced Groovy templates by FreeMarker ### Fixed + - JS publication sources jar ## 0.10.9-kotlin-1.6.10 ### Added + - html builders for readme ### Changed + - Kotlin 1.6.0 - Use indy lambdas by default #32 - Change version scheme to `-kotlin-` ### Fixed + - remove `nativeMain` dependency from `nativeTest` ## 0.10.4 ### Changed + - Kotlin 1.6 ### Fixed + - Some issues with opt-ins ## 0.10.2 ### Added + - Experimental automatic JS project bundling in MPP ### Changed + - Remove vcs requirement for Space publication ## 0.10.0 ### Added + - Lazy readme properties - BOM for kotlin-wrappers on JS - Jupyter loader ### Changed + - API validation disabled for dev versions - Kotlin plugins are propagated downstream ### Removed + - bson support ## 0.9.5 ### Added + - Disable API validation for snapshots - `-Xjvm-default=all` on JVM ### Changed + - `publication.platform` changed to `publishing.platform` - Dokka version to `1.4.30` - `useDateTime` in extension - Kotlin 1.5 ### Removed + - Publish plugin. Use MavenPublish instead ### Fixed + - Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0 ## 0.9.0 ### Added + - Skip sonatype publishing for dev versions ### Changed + - Publishing repositories are explicit and defined in the top level project - Paths to publishing properties now use dot notation like `publishing.github.user` ### Deprecated + - Publishing plugin ### Removed + - Bintray publishing ## 0.8.4 ### Added + - Adaptive support for host OS in native - CSS support for JS targets ### Changed + - Kotlin 1.4.31 - Coroutines 1.4.3 ### Fixed + - Plugin loading order for publishing - Release task - Readme generation for multi-module project @@ -199,11 +253,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.8.1 ### Added + - Ktor version to versions - Add sonatype publishing - Per-platform release publishing ### Changed + - Kotlin to 1.4.30 stable. - Added intermediate jsCommon main/test sourcesSet for node plugin. - Plugin names changed to `ru.mipt.npm` package. @@ -211,15 +267,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Plugins group changed to `ru.mipt.npm` with `gradle` prefix ### Removed + - kaml ### Fixed + - Fix publishing load order for sonatype - Fix root project readme ## 0.7.4 ### Added + - Changelog plugin automatically applied to `project`. - Feature matrix and Readme generation task for a `project` plugin. - Add `binary-compatibility-validator` to the `project` plugin. @@ -228,6 +287,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Suppress API validation for modules with maturity below DEVELOPMENT ### Changed + - Remove node plugin. Node binaries should be turned on manually. - Use default webpack distribution path. - `ru.mipt.npm.base` -> `ru.mipt.npm.project`. @@ -238,15 +298,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Kotlin 1.4.30-RC ### Deprecated + - Support of `kaml` and `snake-yaml` in favor of `yamlKt` - Publish plugin ### Removed + - `useDokka` method. Documentation jar should be added manually if needed. ## 0.6.0 ### Added + - Migrate to kotlin 1.4.0 - Separate Native (current platform) and nodeJs plugins. - Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm. @@ -255,4 +318,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## 0.5.2 ### Added + - Copy resources for jvm modules and jvm source sets in mpp. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 49a58b3..d753a01 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -tools = "0.15.2-kotlin-1.9.22" +tools = "0.16.0-kotlin-1.9.22" kotlin = "1.9.22" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.23.1" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 45d4c8f..6f98673 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -392,6 +392,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.configure { js(IR) { browser() + useEsModules() block() } sourceSets { @@ -463,6 +464,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro } browserConfig() } + useEsModules() jsConfig() binaries.executable() } -- 2.34.1 From 93d881c9a44e428210c0f38d52b6d10943f9e943 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 18 Mar 2024 09:20:09 +0300 Subject: [PATCH 32/50] 2.0.0-beta-4 --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b4e4229..b64c8e5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -tools = "0.15.2-kotlin-2.0.0-Beta2" -kotlin = "2.0.0-Beta2" +tools = "0.15.2-kotlin-2.0.0-Beta4" +kotlin = "2.0.0-Beta4" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.23.1" # https://github.com/Kotlin/binary-compatibility-validator @@ -16,7 +16,7 @@ kotlinx-benchmark = "0.4.9" # https://github.com/Kotlin/kotlinx-cli kotlinx-cli = "0.3.6" # https://github.com/Kotlin/kotlinx.coroutines -kotlinx-coroutines = "1.8.0-RC" +kotlinx-coroutines = "1.8.0" # https://github.com/Kotlin/kotlinx-datetime kotlinx-datetime = "0.4.1" # https://github.com/Kotlin/kotlinx.html -- 2.34.1 From cb1c6d79a7503f859b8fe29181b759628224004c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 20 Apr 2024 09:19:11 +0300 Subject: [PATCH 33/50] 2.0.0-RC1 --- build.gradle.kts | 6 +- gradle/libs.versions.toml | 90 ++++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 3 +- .../kscience/gradle/KScienceExtension.kt | 14 ++- .../space/kscience/gradle/KScienceMPPlugin.kt | 8 +- .../space/kscience/gradle/internal/common.kt | 4 +- 7 files changed, 61 insertions(+), 66 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e9a7bc3..4565be6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,18 +25,18 @@ kotlin.explicitApiWarning() dependencies { api(libs.kotlin.gradle) - api("org.gradle.toolchains:foojay-resolver:0.7.0") + api("org.gradle.toolchains:foojay-resolver:0.8.0") implementation(libs.binary.compatibility.validator) implementation(libs.changelog.gradle) implementation(libs.dokka.gradle) implementation(libs.kotlin.jupyter.gradle) implementation(libs.kotlin.serialization) implementation(libs.kotlinx.html) - implementation("org.tomlj:tomlj:1.1.0") + implementation("org.tomlj:tomlj:1.1.1") // // nexus publishing plugin // implementation("io.github.gradle-nexus:publish-plugin:1.1.0") - implementation("org.freemarker:freemarker:2.3.31") + implementation("org.freemarker:freemarker:2.3.32") testImplementation(kotlin("test")) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b64c8e5..f5f9a47 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,16 +1,54 @@ +## Generated by $ ./gradlew refreshVersionsCatalog + +[plugins] + +changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } + +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + +compose = { id = "org.jetbrains.compose", version.ref = "compose" } + +ktor = {id = "io.ktor.plugin", version.ref = "ktor"} + +gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" } +gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } +gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } +gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" } + +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } +kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" } +kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" } +kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" } +kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" } +kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" } +kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" } +kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } + +kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } + +kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } + [versions] -tools = "0.15.2-kotlin-2.0.0-Beta4" -kotlin = "2.0.0-Beta4" + +tools = "0.15.2-kotlin-2.0.0-RC1" +kotlin = "2.0.0-RC1" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.23.1" # https://github.com/Kotlin/binary-compatibility-validator -binary-compatibility-validator = "0.13.2" +binary-compatibility-validator = "0.14.0" # https://github.com/JetBrains/gradle-changelog-plugin changelog = "2.2.0" # https://github.com/Kotlin/dokka -dokka = "1.9.10" +dokka = "1.9.20" # https://github.com/Kotlin/kotlin-jupyter -kotlin-jupyter = "0.12.0-93" +kotlin-jupyter = "0.12.0-192" # https://github.com/Kotlin/kotlinx-benchmark kotlinx-benchmark = "0.4.9" # https://github.com/Kotlin/kotlinx-cli @@ -20,7 +58,7 @@ kotlinx-coroutines = "1.8.0" # https://github.com/Kotlin/kotlinx-datetime kotlinx-datetime = "0.4.1" # https://github.com/Kotlin/kotlinx.html -kotlinx-html = "0.9.1" +kotlinx-html = "0.11.0" # https://github.com/Kotlin/kotlinx-knit kotlinx-knit = "0.4.0" # https://github.com/Kotlin/kotlinx-nodejs @@ -37,13 +75,14 @@ yamlkt = "0.13.0" jsBom = "1.0.0-pre.648" junit = "5.9.3" # https://github.com/JetBrains/compose-multiplatform -compose = "1.5.11" +compose = "1.6.10-beta01" # https://mvnrepository.com/artifact/org.slf4j/slf4j-api slf4j = "2.0.9" # https://mvnrepository.com/artifact/ch.qos.logback/logback-classic logback = "1.4.11" [libraries] + atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } @@ -105,40 +144,3 @@ yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } - -[plugins] -changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } - -dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } - -compose = { id = "org.jetbrains.compose", version.ref = "compose" } - -ktor = {id = "io.ktor.plugin", version.ref = "ktor"} - -gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" } -gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } -gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } -gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" } -gradle-js = { id = "space.kscience.gradle.js", version.ref = "tools" } -gradle-native = { id = "space.kscience.gradle.native", version.ref = "tools" } -gradle-node = { id = "space.kscience.gradle.node", version.ref = "tools" } - -kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } -kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } -kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } -kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } -kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" } -kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" } -kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" } -kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" } -kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" } -kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } -kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" } -kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } -kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } - -kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } - -kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e411586..48c0a02 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index c16070c..79b57d7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,6 @@ rootProject.name = "gradle-tools" plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0") + id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0") + id("de.fayard.refreshVersions") version "0.60.5" } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 45d4c8f..efcab46 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -230,8 +230,8 @@ public open class KScienceExtension(public val project: Project) { */ public fun useContextReceivers() { project.tasks.withType { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers" + compilerOptions{ + freeCompilerArgs.add("-Xcontext-receivers") } } } @@ -359,10 +359,8 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { jvm { - compilations.all { - compilerOptions.configure { - freeCompilerArgs.addAll(defaultKotlinJvmArgs) - } + compilerOptions{ + freeCompilerArgs.addAll(defaultKotlinJvmArgs) } block() } @@ -458,8 +456,8 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro ) { js { browser { - webpackTask { - mainOutputFileName.set(bundleName) + commonWebpackConfig{ + outputFileName = bundleName } browserConfig() } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index 080bfcc..ada39c6 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -39,12 +39,8 @@ public open class KScienceMPPlugin : Plugin { } } - targets.all { - compilations.all { - kotlinOptions{ - freeCompilerArgs += defaultKotlinCommonArgs - } - } + compilerOptions{ + freeCompilerArgs.addAll(defaultKotlinCommonArgs) } if (explicitApi == null) explicitApiWarning() diff --git a/src/main/kotlin/space/kscience/gradle/internal/common.kt b/src/main/kotlin/space/kscience/gradle/internal/common.kt index 1008006..8013390 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/common.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/common.kt @@ -8,9 +8,7 @@ import space.kscience.gradle.KScienceVersions internal val defaultKotlinJvmArgs: List = listOf( - "-Xjvm-default=all", - "-Xlambdas=indy", - /* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/ + "-Xjvm-default=all" ) internal val defaultKotlinCommonArgs: List = listOf( -- 2.34.1 From 329d0234380620154166e882572c5958e78c5e8f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 20 Apr 2024 12:08:18 +0300 Subject: [PATCH 34/50] 2.0.0-RC1 --- gradle/libs.versions.toml | 4 ++-- src/main/kotlin/space/kscience/gradle/KScienceExtension.kt | 2 ++ src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt | 4 +++- .../kotlin/space/kscience/gradle/KScienceProjectPlugin.kt | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f5f9a47..ed95f64 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -72,10 +72,10 @@ xmlutil = "0.86.2" # https://github.com/Him188/yamlkt yamlkt = "0.13.0" # https://github.com/JetBrains/kotlin-wrappers -jsBom = "1.0.0-pre.648" +jsBom = "1.0.0-pre.732" junit = "5.9.3" # https://github.com/JetBrains/compose-multiplatform -compose = "1.6.10-beta01" +compose = "1.6.2" # https://mvnrepository.com/artifact/org.slf4j/slf4j-api slf4j = "2.0.9" # https://mvnrepository.com/artifact/ch.qos.logback/logback-classic diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index efcab46..12112d8 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -9,6 +9,7 @@ import org.gradle.api.tasks.testing.Test import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension @@ -359,6 +360,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { jvm { + @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions{ freeCompilerArgs.addAll(defaultKotlinJvmArgs) } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index ada39c6..90ab1f2 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -6,11 +6,13 @@ import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.invoke import org.jetbrains.dokka.gradle.DokkaPlugin +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import space.kscience.gradle.internal.applySettings import space.kscience.gradle.internal.defaultKotlinCommonArgs public open class KScienceMPPlugin : Plugin { + override fun apply(project: Project): Unit = project.run { if (!plugins.hasPlugin("org.jetbrains.kotlin.multiplatform")) { //apply() for some reason it does not work @@ -38,7 +40,7 @@ public open class KScienceMPPlugin : Plugin { languageSettings.applySettings() } } - + @OptIn(ExperimentalKotlinGradlePluginApi::class) compilerOptions{ freeCompilerArgs.addAll(defaultKotlinCommonArgs) } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index a613654..fdb73f1 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -91,7 +91,7 @@ public open class KScienceProjectPlugin : Plugin { repositories { mavenCentral() maven("https://repo.kotlin.link") - maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev") + google() } // Workaround for https://github.com/gradle/gradle/issues/15568 -- 2.34.1 From e55e296ab070bbd5d17640bef6e75dc851f04b4b Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 30 Apr 2024 19:41:05 +0300 Subject: [PATCH 35/50] 2.0.0-RC2 --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ed95f64..4ee2ebb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -37,8 +37,8 @@ kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kot [versions] -tools = "0.15.2-kotlin-2.0.0-RC1" -kotlin = "2.0.0-RC1" +tools = "0.15.2-kotlin-2.0.0-RC2" +kotlin = "2.0.0-RC2" # https://github.com/Kotlin/kotlinx-atomicfu atomicfu = "0.23.1" # https://github.com/Kotlin/binary-compatibility-validator -- 2.34.1 From fbdb3e0da9525f063b2ae43c2ad51e03a75c74e4 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 22 May 2024 21:24:37 +0300 Subject: [PATCH 36/50] Update to 2.0.0 --- build.gradle.kts | 25 ++++-- gradle.properties | 2 + gradle/libs.versions.toml | 159 +++++++++++++++----------------------- settings.gradle.kts | 1 - 4 files changed, 83 insertions(+), 104 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4565be6..04d479f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,8 +4,10 @@ plugins { `maven-publish` signing `version-catalog` - alias(libs.plugins.changelog) - alias(libs.plugins.dokka) + alias(libs.plugins.org.jetbrains.changelog) + alias(libs.plugins.org.jetbrains.dokka) + alias(libs.plugins.com.github.ben.manes.versions) + alias(libs.plugins.nl.littlerobots.version.catalog.update) } group = "space.kscience" @@ -25,18 +27,18 @@ kotlin.explicitApiWarning() dependencies { api(libs.kotlin.gradle) - api("org.gradle.toolchains:foojay-resolver:0.8.0") + api(libs.foojay.resolver) implementation(libs.binary.compatibility.validator) implementation(libs.changelog.gradle) implementation(libs.dokka.gradle) implementation(libs.kotlin.jupyter.gradle) implementation(libs.kotlin.serialization) implementation(libs.kotlinx.html) - implementation("org.tomlj:tomlj:1.1.1") + implementation(libs.tomlj) // // nexus publishing plugin -// implementation("io.github.gradle-nexus:publish-plugin:1.1.0") +// implementation("io.github.gradle-nexus:publish-plugin:_") - implementation("org.freemarker:freemarker:2.3.32") + implementation(libs.freemarker) testImplementation(kotlin("test")) } @@ -218,4 +220,13 @@ tasks.processResources.configure { // Workaround for https://github.com/gradle/gradle/issues/15568 tasks.withType().configureEach { mustRunAfter(tasks.withType()) -} \ No newline at end of file +} + +versionCatalogUpdate { + keep { + keepUnusedVersions = true + keepUnusedPlugins = true + keepUnusedLibraries = true + } +} + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 7fc6f1f..e495236 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,3 @@ kotlin.code.style=official + +nl.littlerobots.vcu.resolver=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ee2ebb..c11577d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,23 +1,39 @@ -## Generated by $ ./gradlew refreshVersionsCatalog +[versions] +atomicfu = "0.24.0" +changelog = "2.2.0" +compose = "1.6.10" +dokka = "1.9.20" +jsBom = "1.0.0-pre.751" +# @pin +kotlin = "2.0.0" +kotlin-jupyter = "0.12.0-227" +kotlinx-benchmark = "0.4.10" +kotlinx-cli = "0.3.6" +kotlinx-coroutines = "1.8.1" +kotlinx-datetime = "0.6.0" +kotlinx-html = "0.11.0" +kotlinx-knit = "0.5.0" +kotlinx-nodejs = "0.0.7" +kotlinx-serialization = "1.6.3" +ktor = "2.3.11" +logback = "1.5.6" +slf4j = "2.0.13" +# @pin +tools = "0.15.3-kotlin-2.0.0" +xmlutil = "0.86.3" +yamlkt = "0.13.0" [plugins] - -changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } - -dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } - +com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0" compose = { id = "org.jetbrains.compose", version.ref = "compose" } - -ktor = {id = "io.ktor.plugin", version.ref = "ktor"} - gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" } -gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } -gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" } - +gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } +gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } +kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } @@ -30,117 +46,68 @@ kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", versio kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" } kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } - -kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } - kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } - -[versions] - -tools = "0.15.2-kotlin-2.0.0-RC2" -kotlin = "2.0.0-RC2" -# https://github.com/Kotlin/kotlinx-atomicfu -atomicfu = "0.23.1" -# https://github.com/Kotlin/binary-compatibility-validator -binary-compatibility-validator = "0.14.0" -# https://github.com/JetBrains/gradle-changelog-plugin -changelog = "2.2.0" -# https://github.com/Kotlin/dokka -dokka = "1.9.20" -# https://github.com/Kotlin/kotlin-jupyter -kotlin-jupyter = "0.12.0-192" -# https://github.com/Kotlin/kotlinx-benchmark -kotlinx-benchmark = "0.4.9" -# https://github.com/Kotlin/kotlinx-cli -kotlinx-cli = "0.3.6" -# https://github.com/Kotlin/kotlinx.coroutines -kotlinx-coroutines = "1.8.0" -# https://github.com/Kotlin/kotlinx-datetime -kotlinx-datetime = "0.4.1" -# https://github.com/Kotlin/kotlinx.html -kotlinx-html = "0.11.0" -# https://github.com/Kotlin/kotlinx-knit -kotlinx-knit = "0.4.0" -# https://github.com/Kotlin/kotlinx-nodejs -kotlinx-nodejs = "0.0.7" -# https://github.com/Kotlin/kotlinx.serialization -kotlinx-serialization = "1.6.2" -# https://ktor.io/ -ktor = "2.3.6" -# https://github.com/pdvrieze/xmlutil -xmlutil = "0.86.2" -# https://github.com/Him188/yamlkt -yamlkt = "0.13.0" -# https://github.com/JetBrains/kotlin-wrappers -jsBom = "1.0.0-pre.732" -junit = "5.9.3" -# https://github.com/JetBrains/compose-multiplatform -compose = "1.6.2" -# https://mvnrepository.com/artifact/org.slf4j/slf4j-api -slf4j = "2.0.9" -# https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -logback = "1.4.11" +ktor = { id = "io.ktor.plugin", version.ref = "ktor" } +nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4" +org-gradle-kotlin-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0" +org-jetbrains-changelog = "org.jetbrains.changelog:2.2.0" +org-jetbrains-dokka = "org.jetbrains.dokka:1.9.20" [libraries] - -atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } +analysis-kotlin-descriptors = { module = "org.jetbrains.dokka:analysis-kotlin-descriptors", version.ref = "dokka" } atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } - -binary-compatibility-validator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "binary-compatibility-validator" } - +atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } +binary-compatibility-validator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.15.0-Beta.2" changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } - +dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" } dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } - +dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } +foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.8.0" +freemarker = "org.freemarker:freemarker:2.3.32" +gradle-changelog-plugin = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } +kotlin-assignment-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable", version.ref = "kotlin" } kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } -kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } - -kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" } - +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-js-wrappers = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "jsBom" } - +kotlin-jupyter-api-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin" } +kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" } +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } +kotlin-sam-with-receiver-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin-embeddable", version.ref = "kotlin" } +kotlin-scripting-compiler-embeddable = { module = "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable", version.ref = "kotlin" } +kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" } - +kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-javafx = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-javafx", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-reactive = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactive", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-rx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-javafx = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-javafx", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-slf4j = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j", version.ref = "kotlinx-coroutines" } -kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" } - -kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" } - +kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" } kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } - kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" } - kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "kotlinx-knit" } - kotlinx-nodejs = { module = "org.jetbrains.kotlinx:kotlinx-nodejs", version.ref = "kotlinx-nodejs" } - kotlinx-serialization-cbor = { module = "org.jetbrains.kotlinx:kotlinx-serialization-cbor", version.ref = "kotlinx-serialization" } kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serialization-hocon", version.ref = "kotlinx-serialization" } kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } -kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" } kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" } - +kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" } ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" } - +logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } +slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } +tomlj = "org.tomlj:tomlj:1.1.1" xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" } xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" } xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" } - yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } - -slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } - -logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 79b57d7..c799878 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,5 +2,4 @@ rootProject.name = "gradle-tools" plugins { id("org.gradle.toolchains.foojay-resolver-convention") version("0.8.0") - id("de.fayard.refreshVersions") version "0.60.5" } -- 2.34.1 From ec3e3e3376514a0935f64a0f5e481fd7fbc913fb Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 25 May 2024 21:50:51 +0300 Subject: [PATCH 37/50] 2.0.0 --- build.gradle.kts | 6 +++--- gradle/libs.versions.toml | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 04d479f..cd21f9f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,10 +4,10 @@ plugins { `maven-publish` signing `version-catalog` - alias(libs.plugins.org.jetbrains.changelog) - alias(libs.plugins.org.jetbrains.dokka) + alias(libs.plugins.jetbrains.changelog) + alias(libs.plugins.jetbrains.dokka) alias(libs.plugins.com.github.ben.manes.versions) - alias(libs.plugins.nl.littlerobots.version.catalog.update) + alias(libs.plugins.version.catalog.update) } group = "space.kscience" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c11577d..d285a12 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,14 +22,15 @@ slf4j = "2.0.13" tools = "0.15.3-kotlin-2.0.0" xmlutil = "0.86.3" yamlkt = "0.13.0" +kover = "0.8.0" +junit = "5.10.2" [plugins] com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0" -compose = { id = "org.jetbrains.compose", version.ref = "compose" } -gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" } -gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" } -gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } -gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" } +compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } +kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } @@ -48,13 +49,14 @@ kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization" kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } ktor = { id = "io.ktor.plugin", version.ref = "ktor" } -nl-littlerobots-version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4" -org-gradle-kotlin-kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0" -org-jetbrains-changelog = "org.jetbrains.changelog:2.2.0" -org-jetbrains-dokka = "org.jetbrains.dokka:1.9.20" +version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4" +kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0" +jetbrains-changelog = "org.jetbrains.changelog:2.2.0" +jetbrains-dokka = "org.jetbrains.dokka:1.9.20" +kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } + [libraries] -analysis-kotlin-descriptors = { module = "org.jetbrains.dokka:analysis-kotlin-descriptors", version.ref = "dokka" } atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } binary-compatibility-validator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.15.0-Beta.2" -- 2.34.1 From 43dcf509fb776cdc731c300e266459858e57322d Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 4 Jun 2024 12:49:18 +0300 Subject: [PATCH 38/50] 0.15.4-2.0.0 --- CHANGELOG.md | 1 + gradle/libs.versions.toml | 2 +- .../kscience/gradle/KScienceExtension.kt | 23 ++++++++++--------- .../kscience/gradle/KScienceJVMPlugin.kt | 2 +- .../space/kscience/gradle/KScienceMPPlugin.kt | 8 ++++++- 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 194f8f2..46afcf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- Pass `compose` extension to the kscience extension so compose dependencies could be called directly from kscience block ### Changed - Use ES6 modules by default in JS diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d285a12..e5acdb8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,7 +19,7 @@ ktor = "2.3.11" logback = "1.5.6" slf4j = "2.0.13" # @pin -tools = "0.15.3-kotlin-2.0.0" +tools = "0.15.4-kotlin-2.0.0" xmlutil = "0.86.3" yamlkt = "0.13.0" kover = "0.8.0" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 893c18d..97cc462 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -3,6 +3,7 @@ package space.kscience.gradle import org.gradle.api.Project import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.plugins.ApplicationPlugin +import org.gradle.api.plugins.ExtensionAware import org.gradle.api.provider.Property import org.gradle.api.tasks.Copy import org.gradle.api.tasks.testing.Test @@ -28,6 +29,7 @@ import space.kscience.gradle.internal.defaultKotlinJvmArgs import space.kscience.gradle.internal.fromJsDependencies import space.kscience.gradle.internal.requestPropertyOrNull import space.kscience.gradle.internal.useCommonDependency +import javax.inject.Inject public enum class DependencyConfiguration { API, @@ -52,7 +54,7 @@ public val Project.isInDevelopment: Boolean private const val defaultJdkVersion = 11 -public open class KScienceExtension(public val project: Project) { +public abstract class KScienceExtension @Inject constructor(public val project: Project): ExtensionAware { public val jdkVersionProperty: Property = project.objects.property().apply { set(defaultJdkVersion) @@ -352,7 +354,8 @@ public class KScienceNativeConfiguration(private val project: Project) { ): Unit = target(KScienceNativeTarget(preset, targetName, targetConfiguration)) } -public open class KScienceMppExtension(project: Project) : KScienceExtension(project) { +public abstract class KScienceMppExtension @Inject constructor(project: Project) : KScienceExtension(project) { + /** * Enable jvm target */ @@ -414,10 +417,6 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro */ @OptIn(ExperimentalWasmDsl::class) public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) { -// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { -// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") -// return -// } project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.configure { @@ -538,9 +537,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro } -internal inline fun Project.registerKScienceExtension(constructor: (Project) -> T): T { - extensions.findByType()?.let { return it } - return constructor(this).also { - extensions.add("kscience", it) - } +internal inline fun Project.registerKScienceExtension():T { +// extensions.findByType()?.let { return it } +// return constructor(this).also { +// extensions.add("kscience", it) +// } + + return extensions.create("kscience", T::class.java) } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt index 4cd7f56..1cb85e1 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceJVMPlugin.kt @@ -22,7 +22,7 @@ public open class KScienceJVMPlugin : Plugin { } else { logger.info("Kotlin JVM plugin is already present") } - val extension = registerKScienceExtension(::KScienceExtension) + val extension = registerKScienceExtension() //logger.info("Applying KScience configuration for JVM project") configure { diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index 90ab1f2..03cc281 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -21,7 +21,7 @@ public open class KScienceMPPlugin : Plugin { logger.info("Kotlin MPP plugin is already present") } - registerKScienceExtension(::KScienceMppExtension) + val kscience = registerKScienceExtension() configure { sourceSets { @@ -46,6 +46,12 @@ public open class KScienceMPPlugin : Plugin { } if (explicitApi == null) explicitApiWarning() + + //pass compose extension inside kscience extensions to make it available inside kscience block + plugins.withId("org.jetbrains.compose"){ + kscience.extensions.add("compose", (this@configure as org.gradle.api.plugins.ExtensionAware).extensions.getByName("compose")) + } + } -- 2.34.1 From d93b0a578f7433302fd2e566b606a08405069925 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 4 Jun 2024 12:52:49 +0300 Subject: [PATCH 39/50] 0.15.4-2.0.0 --- CHANGELOG.md | 13 +++++++++++-- gradle/libs.versions.toml | 27 +++++++++++++-------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46afcf2..31835d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,10 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added -- Pass `compose` extension to the kscience extension so compose dependencies could be called directly from kscience block ### Changed -- Use ES6 modules by default in JS ### Deprecated @@ -20,6 +18,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Security +## 0.15.4-kotlin-2.0.0 - 2024-06-04 + +### Added + +- Pass `compose` extension to the kscience extension so compose dependencies could be called directly from kscience block + +### Changed + +- Use ES6 modules by default in JS +- Kotlin 2.0 + ## 0.15.2-kotlin-1.9.22 - 2024-02-09 ### Added diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e5acdb8..c74469e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,13 @@ [versions] atomicfu = "0.24.0" changelog = "2.2.0" -compose = "1.6.10" +compose = "1.6.11" dokka = "1.9.20" -jsBom = "1.0.0-pre.751" +jsBom = "1.0.0-pre.754" +junit = "5.10.2" # @pin kotlin = "2.0.0" -kotlin-jupyter = "0.12.0-227" +kotlin-jupyter = "0.12.0-230" kotlinx-benchmark = "0.4.10" kotlinx-cli = "0.3.6" kotlinx-coroutines = "1.8.1" @@ -15,6 +16,7 @@ kotlinx-html = "0.11.0" kotlinx-knit = "0.5.0" kotlinx-nodejs = "0.0.7" kotlinx-serialization = "1.6.3" +kover = "0.8.0" ktor = "2.3.11" logback = "1.5.6" slf4j = "2.0.13" @@ -22,17 +24,16 @@ slf4j = "2.0.13" tools = "0.15.4-kotlin-2.0.0" xmlutil = "0.86.3" yamlkt = "0.13.0" -kover = "0.8.0" -junit = "5.10.2" [plugins] com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0" -compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } -kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } -kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" } +compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } +jetbrains-changelog = "org.jetbrains.changelog:2.2.0" +jetbrains-dokka = "org.jetbrains.dokka:1.9.20" kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } +kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0" kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } @@ -48,13 +49,11 @@ kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", versio kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" } kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" } +kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } +kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" } ktor = { id = "io.ktor.plugin", version.ref = "ktor" } version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4" -kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0" -jetbrains-changelog = "org.jetbrains.changelog:2.2.0" -jetbrains-dokka = "org.jetbrains.dokka:1.9.20" -kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } - [libraries] atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } @@ -65,7 +64,7 @@ dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.8.0" -freemarker = "org.freemarker:freemarker:2.3.32" +freemarker = "org.freemarker:freemarker:2.3.33" gradle-changelog-plugin = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } kotlin-assignment-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable", version.ref = "kotlin" } kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } -- 2.34.1 From 53517859d4ed28e7320ae9e8d9d04d14f30ab4cb Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 24 Jun 2024 16:58:16 +0300 Subject: [PATCH 40/50] fix pom organization --- src/main/kotlin/space/kscience/gradle/pomConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/kotlin/space/kscience/gradle/pomConfig.kt b/src/main/kotlin/space/kscience/gradle/pomConfig.kt index 5cea379..dc4770d 100644 --- a/src/main/kotlin/space/kscience/gradle/pomConfig.kt +++ b/src/main/kotlin/space/kscience/gradle/pomConfig.kt @@ -17,7 +17,7 @@ public fun MavenPom.useSPCTeam(){ developer { id.set("SPC") name.set("Scientific programming centre") - organization.set("MIPT") + organization.set("SPC") organizationUrl.set("https://sciprog.center/") } } -- 2.34.1 From 91a82153fdfeaffefea98fe2da448b3518ec62a2 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 25 Jul 2024 09:48:40 +0300 Subject: [PATCH 41/50] Kotlin 2.0.20-Beta2. Add KSP --- build.gradle.kts | 5 +++-- gradle/libs.versions.toml | 17 +++++++++++------ .../space/kscience/gradle/KScienceExtension.kt | 2 +- .../space/kscience/gradle/internal/common.kt | 2 -- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index cd21f9f..354a3f8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,8 +6,8 @@ plugins { `version-catalog` alias(libs.plugins.jetbrains.changelog) alias(libs.plugins.jetbrains.dokka) - alias(libs.plugins.com.github.ben.manes.versions) - alias(libs.plugins.version.catalog.update) + alias(libs.plugins.versions) + alias(libs.plugins.versions.update) } group = "space.kscience" @@ -223,6 +223,7 @@ tasks.withType().configureEach { } versionCatalogUpdate { + sortByKey.set(false) keep { keepUnusedVersions = true keepUnusedPlugins = true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c74469e..bf8bf86 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,15 @@ [versions] +# @pin +kotlin = "2.0.20-Beta2" +# @pin +tools = "0.15.4-kotlin-2.0.20-Beta2" + atomicfu = "0.24.0" changelog = "2.2.0" compose = "1.6.11" dokka = "1.9.20" jsBom = "1.0.0-pre.754" junit = "5.10.2" -# @pin -kotlin = "2.0.0" kotlin-jupyter = "0.12.0-230" kotlinx-benchmark = "0.4.10" kotlinx-cli = "0.3.6" @@ -18,15 +21,13 @@ kotlinx-nodejs = "0.0.7" kotlinx-serialization = "1.6.3" kover = "0.8.0" ktor = "2.3.11" +ksp = "2.0.0-1.0.23" logback = "1.5.6" slf4j = "2.0.13" -# @pin -tools = "0.15.4-kotlin-2.0.0" xmlutil = "0.86.3" yamlkt = "0.13.0" [plugins] -com-github-ben-manes-versions = "com.github.ben-manes.versions:0.51.0" compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } jetbrains-changelog = "org.jetbrains.changelog:2.2.0" @@ -52,8 +53,10 @@ kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kot kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } kscience-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" } kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } ktor = { id = "io.ktor.plugin", version.ref = "ktor" } -version-catalog-update = "nl.littlerobots.version-catalog-update:0.8.4" +versions = "com.github.ben-manes.versions:0.51.0" +versions-update = "nl.littlerobots.version-catalog-update:0.8.4" [libraries] atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } @@ -104,6 +107,7 @@ kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serializ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" } kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" } +ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" } logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } @@ -112,3 +116,4 @@ xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlu xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" } xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" } yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } + diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 97cc462..053d3be 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -11,6 +11,7 @@ import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.* import org.gradle.language.jvm.tasks.ProcessResources import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension @@ -18,7 +19,6 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl diff --git a/src/main/kotlin/space/kscience/gradle/internal/common.kt b/src/main/kotlin/space/kscience/gradle/internal/common.kt index 8013390..46b1474 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/common.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/common.kt @@ -30,11 +30,9 @@ internal fun LanguageSettingsBuilder.applySettings( optIn("kotlin.RequiresOptIn") - optIn("kotlin.ExperimentalUnsignedTypes") optIn("kotlin.ExperimentalStdlibApi") optIn("kotlin.time.ExperimentalTime") optIn("kotlin.contracts.ExperimentalContracts") - optIn("kotlin.js.ExperimentalJsExport") } internal fun Copy.fromJsDependencies(configurationName: String) = project.run { -- 2.34.1 From 2bd93104d6faa25a90c72aaa17d64a9067c86734 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 25 Jul 2024 09:56:40 +0300 Subject: [PATCH 42/50] Return optins --- src/main/kotlin/space/kscience/gradle/internal/common.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/kotlin/space/kscience/gradle/internal/common.kt b/src/main/kotlin/space/kscience/gradle/internal/common.kt index 46b1474..8013390 100644 --- a/src/main/kotlin/space/kscience/gradle/internal/common.kt +++ b/src/main/kotlin/space/kscience/gradle/internal/common.kt @@ -30,9 +30,11 @@ internal fun LanguageSettingsBuilder.applySettings( optIn("kotlin.RequiresOptIn") + optIn("kotlin.ExperimentalUnsignedTypes") optIn("kotlin.ExperimentalStdlibApi") optIn("kotlin.time.ExperimentalTime") optIn("kotlin.contracts.ExperimentalContracts") + optIn("kotlin.js.ExperimentalJsExport") } internal fun Copy.fromJsDependencies(configurationName: String) = project.run { -- 2.34.1 From d6276e0ca05165c5d99356126be87aaa997b2f25 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 25 Jul 2024 10:08:06 +0300 Subject: [PATCH 43/50] update versions --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bf8bf86..86771b2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ # @pin kotlin = "2.0.20-Beta2" # @pin -tools = "0.15.4-kotlin-2.0.20-Beta2" +tools = "0.15.5-kotlin-2.0.20-Beta2" atomicfu = "0.24.0" changelog = "2.2.0" -- 2.34.1 From 5c7dc3c7294990066e84934d0a7a9086e8b3b2dd Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 26 Aug 2024 10:21:27 +0300 Subject: [PATCH 44/50] Kotlin 2.0.20 + JDK 17 + versions update --- build.gradle.kts | 7 +--- gradle/libs.versions.toml | 38 +++++++++---------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../kscience/gradle/KScienceExtension.kt | 2 +- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 354a3f8..23f3011 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,8 +23,6 @@ repositories { maven("https://repo.kotlin.link") } -kotlin.explicitApiWarning() - dependencies { api(libs.kotlin.gradle) api(libs.foojay.resolver) @@ -207,9 +205,8 @@ publishing { } kotlin { - jvmToolchain { - languageVersion.set(JavaLanguageVersion.of(11)) - } + explicitApiWarning() + jvmToolchain(17) } tasks.processResources.configure { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 86771b2..16cdbd7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,40 +1,39 @@ [versions] # @pin -kotlin = "2.0.20-Beta2" +kotlin = "2.0.20" # @pin -tools = "0.15.5-kotlin-2.0.20-Beta2" - -atomicfu = "0.24.0" -changelog = "2.2.0" +tools = "0.15.6-kotlin-2.0.20" +atomicfu = "0.25.0" +changelog = "2.2.1" compose = "1.6.11" dokka = "1.9.20" -jsBom = "1.0.0-pre.754" +jsBom = "1.0.0-pre.798" junit = "5.10.2" -kotlin-jupyter = "0.12.0-230" -kotlinx-benchmark = "0.4.10" +kotlin-jupyter = "0.12.0-275" +kotlinx-benchmark = "0.4.12" kotlinx-cli = "0.3.6" kotlinx-coroutines = "1.8.1" -kotlinx-datetime = "0.6.0" +kotlinx-datetime = "0.6.1" kotlinx-html = "0.11.0" kotlinx-knit = "0.5.0" kotlinx-nodejs = "0.0.7" -kotlinx-serialization = "1.6.3" -kover = "0.8.0" -ktor = "2.3.11" -ksp = "2.0.0-1.0.23" -logback = "1.5.6" -slf4j = "2.0.13" -xmlutil = "0.86.3" +kotlinx-serialization = "1.7.1" +kover = "0.8.3" +ktor = "2.3.12" +ksp = "2.0.20-1.0.24" +logback = "1.5.7" +slf4j = "2.0.16" +xmlutil = "0.90.1" yamlkt = "0.13.0" [plugins] compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } -jetbrains-changelog = "org.jetbrains.changelog:2.2.0" +jetbrains-changelog = "org.jetbrains.changelog:2.2.1" jetbrains-dokka = "org.jetbrains.dokka:1.9.20" kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } -kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:4.4.0" +kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.0" kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } @@ -61,7 +60,7 @@ versions-update = "nl.littlerobots.version-catalog-update:0.8.4" [libraries] atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } -binary-compatibility-validator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.15.0-Beta.2" +binary-compatibility-validator = "org.jetbrains.kotlinx:binary-compatibility-validator:0.15.0-Beta.3" changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" } dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } @@ -116,4 +115,3 @@ xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlu xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" } xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" } yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" } - diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 48c0a02..e1adfb4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt index 053d3be..66c9914 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceExtension.kt @@ -52,7 +52,7 @@ public val Project.isInDevelopment: Boolean || version.toString().endsWith("SNAPSHOT") -private const val defaultJdkVersion = 11 +private const val defaultJdkVersion = 17 public abstract class KScienceExtension @Inject constructor(public val project: Project): ExtensionAware { -- 2.34.1 From 37e5603389e5877a405b8ac934d2cc4ae88b3752 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 26 Aug 2024 16:40:46 +0300 Subject: [PATCH 45/50] Add readme task validation --- gradle/libs.versions.toml | 2 +- .../kscience/gradle/KScienceProjectPlugin.kt | 25 ++++++++------ .../gradle/KScienceReadmeExtension.kt | 34 +++++++++++++++++++ 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 16cdbd7..c13af9e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ # @pin kotlin = "2.0.20" # @pin -tools = "0.15.6-kotlin-2.0.20" +tools = "0.15.7-kotlin-2.0.20" atomicfu = "0.25.0" changelog = "2.2.1" compose = "1.6.11" diff --git a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt index fdb73f1..d1ec666 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceProjectPlugin.kt @@ -126,6 +126,8 @@ public open class KScienceProjectPlugin : Plugin { group = "documentation" description = "Generate a README file if stub is present" + inputs.property("extension", readmeExtension) + if (readmeExtension.readmeTemplate.exists()) { inputs.file(readmeExtension.readmeTemplate) } @@ -161,6 +163,8 @@ public open class KScienceProjectPlugin : Plugin { } } + inputs.property("extension", rootReadmeExtension) + if (rootReadmeExtension.readmeTemplate.exists()) { inputs.file(rootReadmeExtension.readmeTemplate) } @@ -185,18 +189,17 @@ public open class KScienceProjectPlugin : Plugin { val modulesString = buildString { subprojects.forEach { subproject -> // val name = subproject.name - subproject.extensions.findByType() - ?.let { ext: KScienceReadmeExtension -> - val path = subproject.path.replaceFirst(":", "").replace(":", "/") - appendLine("\n### [$path]($path)") - ext.description?.let { appendLine("> ${ext.description}") } - appendLine(">\n> **Maturity**: ${ext.maturity}") - val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/") - if (featureString.isNotBlank()) { - appendLine(">\n> **Features:**") - appendLine(featureString) - } + subproject.extensions.findByType()?.let { ext -> + val path = subproject.path.replaceFirst(":", "").replace(":", "/") + appendLine("\n### [$path]($path)") + ext.description?.let { appendLine("> ${ext.description}") } + appendLine(">\n> **Maturity**: ${ext.maturity}") + val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/") + if (featureString.isNotBlank()) { + appendLine(">\n> **Features:**") + appendLine(featureString) } + } } } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt b/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt index af16822..8345fac 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceReadmeExtension.kt @@ -190,4 +190,38 @@ public class KScienceReadmeExtension(public val project: Project) { project.logger.warn("Template with name ${ex.templateName} not found in ${project.name}") null } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as KScienceReadmeExtension + + if (project != other.project) return false + if (maturity != other.maturity) return false + if (useDefaultReadmeTemplate != other.useDefaultReadmeTemplate) return false + if (readmeTemplate != other.readmeTemplate) return false + if (fmLoader != other.fmLoader) return false + if (fmCfg != other.fmCfg) return false + if (features != other.features) return false + if (properties != other.properties) return false + if (inputFiles != other.inputFiles) return false + + return true + } + + override fun hashCode(): Int { + var result = project.hashCode() + result = 31 * result + maturity.hashCode() + result = 31 * result + useDefaultReadmeTemplate.hashCode() + result = 31 * result + readmeTemplate.hashCode() + result = 31 * result + fmLoader.hashCode() + result = 31 * result + fmCfg.hashCode() + result = 31 * result + features.hashCode() + result = 31 * result + properties.hashCode() + result = 31 * result + inputFiles.hashCode() + return result + } + + } -- 2.34.1 From 558fd695b975823e6ad5670c585e58f42b8e4e49 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 22 Sep 2024 17:52:08 +0300 Subject: [PATCH 46/50] beta/2.1.0 --- gradle/libs.versions.toml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 16cdbd7..b8fa514 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,27 +1,27 @@ [versions] # @pin -kotlin = "2.0.20" +kotlin = "2.1.0-Beta1" # @pin -tools = "0.15.6-kotlin-2.0.20" +tools = "0.15.6-kotlin-2.1.0-Beta1" atomicfu = "0.25.0" changelog = "2.2.1" compose = "1.6.11" dokka = "1.9.20" -jsBom = "1.0.0-pre.798" +jsBom = "1.0.0-pre.810" junit = "5.10.2" -kotlin-jupyter = "0.12.0-275" +kotlin-jupyter = "0.12.0-291" kotlinx-benchmark = "0.4.12" kotlinx-cli = "0.3.6" -kotlinx-coroutines = "1.8.1" +kotlinx-coroutines = "1.9.0" kotlinx-datetime = "0.6.1" kotlinx-html = "0.11.0" kotlinx-knit = "0.5.0" kotlinx-nodejs = "0.0.7" -kotlinx-serialization = "1.7.1" +kotlinx-serialization = "1.7.3" kover = "0.8.3" ktor = "2.3.12" -ksp = "2.0.20-1.0.24" -logback = "1.5.7" +ksp = "2.0.20-1.0.25" +logback = "1.5.8" slf4j = "2.0.16" xmlutil = "0.90.1" yamlkt = "0.13.0" @@ -33,7 +33,7 @@ jetbrains-changelog = "org.jetbrains.changelog:2.2.1" jetbrains-dokka = "org.jetbrains.dokka:1.9.20" kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } -kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.0" +kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.1" kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -- 2.34.1 From b507cb05363d5f3b9bec4d6470a8788863a04997 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 9 Dec 2024 07:43:23 +0300 Subject: [PATCH 47/50] version update Ktor -> 3.0 Compose -> 1.7 --- gradle/libs.versions.toml | 32 +++++++++---------- .../space/kscience/gradle/KScienceMPPlugin.kt | 9 ++++-- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b8fa514..459f01d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,16 +1,16 @@ [versions] # @pin -kotlin = "2.1.0-Beta1" +kotlin = "2.1.0" # @pin -tools = "0.15.6-kotlin-2.1.0-Beta1" -atomicfu = "0.25.0" +tools = "0.15.7-kotlin-2.1.0" +atomicfu = "0.26.1" changelog = "2.2.1" -compose = "1.6.11" -dokka = "1.9.20" -jsBom = "1.0.0-pre.810" +compose = "1.7.1" +dokka = "2.0.0-Beta" +jsBom = "1.0.0-pre.847" junit = "5.10.2" -kotlin-jupyter = "0.12.0-291" -kotlinx-benchmark = "0.4.12" +kotlin-jupyter = "0.12.0-352" +kotlinx-benchmark = "0.4.13" kotlinx-cli = "0.3.6" kotlinx-coroutines = "1.9.0" kotlinx-datetime = "0.6.1" @@ -19,21 +19,21 @@ kotlinx-knit = "0.5.0" kotlinx-nodejs = "0.0.7" kotlinx-serialization = "1.7.3" kover = "0.8.3" -ktor = "2.3.12" -ksp = "2.0.20-1.0.25" -logback = "1.5.8" +ktor = "3.0.2" +ksp = "2.1.0-1.0.29" +logback = "1.5.12" slf4j = "2.0.16" -xmlutil = "0.90.1" +xmlutil = "0.90.3" yamlkt = "0.13.0" [plugins] compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } jetbrains-changelog = "org.jetbrains.changelog:2.2.1" -jetbrains-dokka = "org.jetbrains.dokka:1.9.20" +jetbrains-dokka = { module = "org.jetbrains.dokka", version.ref = "dokka" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } -kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.1" +kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.2" kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } @@ -55,7 +55,7 @@ kscience-project = { id = "space.kscience.gradle.project", version.ref = "tools" ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } ktor = { id = "io.ktor.plugin", version.ref = "ktor" } versions = "com.github.ben-manes.versions:0.51.0" -versions-update = "nl.littlerobots.version-catalog-update:0.8.4" +versions-update = "nl.littlerobots.version-catalog-update:0.8.5" [libraries] atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } @@ -65,7 +65,7 @@ changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-p dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" } dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" } -foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.8.0" +foojay-resolver = "org.gradle.toolchains:foojay-resolver:0.9.0" freemarker = "org.freemarker:freemarker:2.3.33" gradle-changelog-plugin = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" } kotlin-assignment-compiler-plugin-embeddable = { module = "org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable", version.ref = "kotlin" } diff --git a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt index 03cc281..8741a82 100644 --- a/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt +++ b/src/main/kotlin/space/kscience/gradle/KScienceMPPlugin.kt @@ -41,15 +41,18 @@ public open class KScienceMPPlugin : Plugin { } } @OptIn(ExperimentalKotlinGradlePluginApi::class) - compilerOptions{ + compilerOptions { freeCompilerArgs.addAll(defaultKotlinCommonArgs) } if (explicitApi == null) explicitApiWarning() //pass compose extension inside kscience extensions to make it available inside kscience block - plugins.withId("org.jetbrains.compose"){ - kscience.extensions.add("compose", (this@configure as org.gradle.api.plugins.ExtensionAware).extensions.getByName("compose")) + plugins.withId("org.jetbrains.compose") { + kscience.extensions.add( + "compose", + (this@configure as org.gradle.api.plugins.ExtensionAware).extensions.getByName("compose") + ) } } -- 2.34.1 From 0dc345817669c5881a46e6e67b2b345517d4cbcb Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 9 Dec 2024 07:51:17 +0300 Subject: [PATCH 48/50] fix dokka --- gradle.properties | 2 +- gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index e495236..cd8d64d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ kotlin.code.style=official -nl.littlerobots.vcu.resolver=true +nl.littlerobots.vcu.resolver=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c4aaca3..9918bc6 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -30,7 +30,7 @@ yamlkt = "0.13.0" compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } jetbrains-changelog = "org.jetbrains.changelog:2.2.1" -jetbrains-dokka = { module = "org.jetbrains.dokka", version.ref = "dokka" } +jetbrains-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" } kotlin-dsl = "org.gradle.kotlin.kotlin-dsl:5.1.2" -- 2.34.1 From 2e1f3876af258079c4890cfe5f3025dc43d0e843 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 9 Dec 2024 09:22:00 +0300 Subject: [PATCH 49/50] Migrate to new central publish --- build.gradle.kts | 99 +++++++++++++-------------------------- gradle/libs.versions.toml | 1 + 2 files changed, 34 insertions(+), 66 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 23f3011..42c41cc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,8 +2,9 @@ plugins { `java-gradle-plugin` `kotlin-dsl` `maven-publish` - signing +// signing `version-catalog` + alias(libs.plugins.maven.publish) alias(libs.plugins.jetbrains.changelog) alias(libs.plugins.jetbrains.dokka) alias(libs.plugins.versions) @@ -111,54 +112,36 @@ val emptySourcesJar by tasks.creating(Jar::class) { archiveBaseName.set("empty") } -publishing { - val vcs = "https://github.com/SciProgCentre/gradle-tools" - // Process each publication we have in this project - publications { - create("catalog") { - from(components["versionCatalog"]) - artifactId = "version-catalog" +mavenPublishing { + val vcs = "https://git.sciprog.center/kscience/gradle-tools" - pom { - name.set("version-catalog") + pom { + name.set(project.name) + description.set(project.description) + url.set(vcs) + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") } } - withType { - // thanks @vladimirsitnikv for the fix - artifact(if (name == "catalog") emptySourcesJar else sourcesJar) - artifact(if (name == "catalog") emptyJavadocJar else javadocsJar) - - - pom { - name.set(project.name) - description.set(project.description) - url.set(vcs) - - licenses { - license { - name.set("The Apache Software License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") - distribution.set("repo") - } - } - - developers { - developer { - id.set("SPC") - name.set("Scientific Programming Centre") - organization.set("SPC") - organizationUrl.set("https://sciprog.center/") - } - } - - scm { - url.set(vcs) - tag.set(project.version.toString()) - } + developers { + developer { + id.set("SPC") + name.set("Scientific Programming Centre") + organization.set("SPC") + organizationUrl.set("https://sciprog.center/") } } + + scm { + url.set(vcs) + tag.set(project.version.toString()) + } } val spaceRepo = "https://maven.sciprog.center/kscience" @@ -166,7 +149,7 @@ publishing { val spcToken: String? = findProperty("publishing.spc.token") as? String if (spcUser != null && spcToken != null) { - repositories.maven { + publishing.repositories.maven { name = "spc" url = uri(spaceRepo) @@ -177,31 +160,15 @@ publishing { } } - val sonatypeUser: String? = project.findProperty("publishing.sonatype.user") as? String - val sonatypePassword: String? = project.findProperty("publishing.sonatype.password") as? String + val centralUser: String? = project.findProperty("mavenCentralUsername") as? String + val centralPassword: String? = project.findProperty("mavenCentralPassword") as? String - if (sonatypeUser != null && sonatypePassword != null) { - val sonatypeRepo: String = if (project.version.toString().contains("dev")) { - "https://oss.sonatype.org/content/repositories/snapshots" - } else { - "https://oss.sonatype.org/service/local/staging/deploy/maven2" - } - - repositories.maven { - name = "sonatype" - url = uri(sonatypeRepo) - - credentials { - username = sonatypeUser - password = sonatypePassword - } - } - - signing { - //useGpgCmd() - sign(publications) - } + if (centralUser != null && centralPassword != null) { + publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL) + signAllPublications() } + + configure(com.vanniktech.maven.publish.VersionCatalog()) } kotlin { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9918bc6..8f1e72b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -27,6 +27,7 @@ xmlutil = "0.90.3" yamlkt = "0.13.0" [plugins] +maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" } jetbrains-changelog = "org.jetbrains.changelog:2.2.1" -- 2.34.1 From a6a1ed41023a0faeb22c059ea7064860340517e7 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 9 Dec 2024 09:47:28 +0300 Subject: [PATCH 50/50] Migrate to new central publish --- build.gradle.kts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 42c41cc..6e3f9e0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ + plugins { `java-gradle-plugin` `kotlin-dsl` @@ -112,8 +113,18 @@ val emptySourcesJar by tasks.creating(Jar::class) { archiveBaseName.set("empty") } - mavenPublishing { + configure( + com.vanniktech.maven.publish.GradlePlugin( + javadocJar = com.vanniktech.maven.publish.JavadocJar.Dokka("dokkaHtml"), + sourcesJar = true, + ) + ) + + project.publishing.publications.create("maven", MavenPublication::class.java) { + from(project.components.getByName("versionCatalog")) + } + val vcs = "https://git.sciprog.center/kscience/gradle-tools" pom { @@ -167,8 +178,6 @@ mavenPublishing { publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL) signAllPublications() } - - configure(com.vanniktech.maven.publish.VersionCatalog()) } kotlin { -- 2.34.1