From f202500943e9cdfba308af37bd90a594c23cdd71 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 27 Oct 2025 17:30:15 +0000 Subject: [PATCH 1/6] Remove `VersionWriter.kt` on update --- migrate | 3 +++ 1 file changed, 3 insertions(+) diff --git a/migrate b/migrate index 62a6fca1c..fd5e07bf4 100755 --- a/migrate +++ b/migrate @@ -49,6 +49,9 @@ cp -a .github-workflows/. ../.github/workflows cp -a .github/workflows/. ../.github/workflows rm -f ../.github/workflows/detekt-code-analysis.yml # This one is `config`-only workflow. +# 2025-10-27 Remove `VersionWriter.kt` +rm -f ../buildSrc/src/main/kotlin/io/spine/gradle/VersionWriter.kt + # 2025-10-01 Remove renamed `CoreJava.kt` rm -f ../buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt From 6766b3077a96e4ad50ee9d8d37b38dcaea19d127 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 27 Oct 2025 17:47:15 +0000 Subject: [PATCH 2/6] Remove `VersionWriter.kt` and `ProtoTaskExtensions.kt` on update --- .../kotlin/io/spine/gradle/VersionWriter.kt | 149 ------------------ migrate | 3 +- 2 files changed, 2 insertions(+), 150 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/io/spine/gradle/VersionWriter.kt diff --git a/buildSrc/src/main/kotlin/io/spine/gradle/VersionWriter.kt b/buildSrc/src/main/kotlin/io/spine/gradle/VersionWriter.kt deleted file mode 100644 index d3d4323f8..000000000 --- a/buildSrc/src/main/kotlin/io/spine/gradle/VersionWriter.kt +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2025, TeamDev. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Redistribution and use in source and/or binary forms, with or without - * modification, must retain the above copyright notice and the following - * disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package io.spine.gradle - -import java.util.* -import org.gradle.api.DefaultTask -import org.gradle.api.Plugin -import org.gradle.api.Project -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.provider.MapProperty -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.TaskAction - -/** - * A task that generates a dependency versions `.properties` file. - */ -abstract class WriteVersions : DefaultTask() { - - /** - * Versions to add to the file. - * - * The map key is a string in the format of `_`, and the value - * is the version corresponding to those group ID and artifact name. - * - * @see WriteVersions.version - */ - @get:Input - abstract val versions: MapProperty - - /** - * The directory that hosts the generated file. - */ - @get:OutputDirectory - abstract val versionsFileLocation: DirectoryProperty - - /** - * Adds a dependency version to write into the file. - * - * The given dependency notation is a Gradle artifact string of format: - * `"::"`. - * - * @see WriteVersions.versions - * @see WriteVersions.includeOwnVersion - */ - fun version(dependencyNotation: String) { - val parts = dependencyNotation.split(":") - check(parts.size == 3) { "Invalid dependency notation: `$dependencyNotation`." } - versions.put("${parts[0]}_${parts[1]}", parts[2]) - } - - /** - * Enables the versions file to include the version of the project that owns this task. - * - * @see WriteVersions.version - * @see WriteVersions.versions - */ - fun includeOwnVersion() { - val groupId = project.group.toString() - val artifactId = project.artifactId - val version = project.version.toString() - versions.put("${groupId}_${artifactId}", version) - } - - /** - * Creates a `.properties` file with versions, named after the value - * of [Project.artifactId] property. - * - * The name of the file would be: `versions-.properties`. - * - * By default, value of [Project.artifactId] property is a project's name with "spine-" prefix. - * For example, if a project's name is "tools", then the name of the file would be: - * `versions-spine-tools.properties`. - */ - @TaskAction - fun writeFile() { - versions.finalizeValue() - versionsFileLocation.finalizeValue() - - val values = versions.get() - val properties = Properties() - properties.putAll(values) - val outputDir = versionsFileLocation.get().asFile - outputDir.mkdirs() - val fileName = resourceFileName() - val file = outputDir.resolve(fileName) - file.createNewFile() - file.writer().use { - properties.store(it, "Dependency versions supplied by the `$path` task.") - } - } - - private fun resourceFileName(): String { - val artifactId = project.artifactId - return "versions-${artifactId}.properties" - } -} - -/** - * A plugin that enables storing dependency versions into a resource file. - * - * Dependency version may be used by Gradle plugins at runtime. - * - * The plugin adds one task — `writeVersions`, which generates a `.properties` file with some - * dependency versions. - * - * The generated file will be available in classpath of the target project under the name: - * `versions-.properties`, where `` is the name of the target - * Gradle project. - */ -@Suppress("unused") -class VersionWriter : Plugin { - - override fun apply(target: Project): Unit = with (target.tasks) { - val task = register("writeVersions", WriteVersions::class.java) { - versionsFileLocation.convention(project.layout.buildDirectory.dir(name)) - includeOwnVersion() - project.sourceSets - .getByName("main") - .resources - .srcDir(versionsFileLocation) - } - getByName("processResources").dependsOn(task) - } -} diff --git a/migrate b/migrate index fd5e07bf4..cc051c670 100755 --- a/migrate +++ b/migrate @@ -49,8 +49,9 @@ cp -a .github-workflows/. ../.github/workflows cp -a .github/workflows/. ../.github/workflows rm -f ../.github/workflows/detekt-code-analysis.yml # This one is `config`-only workflow. -# 2025-10-27 Remove `VersionWriter.kt` +# 2025-10-27 Remove `VersionWriter.kt` and `ProtoTaskExtensions.kt` rm -f ../buildSrc/src/main/kotlin/io/spine/gradle/VersionWriter.kt +rm -f ../buildSrc/src/main/kotlin/io/spine/gradle/protobuf/ProtoTaskExtensions.kt # 2025-10-01 Remove renamed `CoreJava.kt` rm -f ../buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt From c05048a4ac160c9caaac2c60aa8dbcd5d4586361 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 27 Oct 2025 17:47:55 +0000 Subject: [PATCH 3/6] Bring updates from Compiler, ToolBase, and CoreJvm Compiler --- buildSrc/build.gradle.kts | 6 +++--- buildSrc/src/main/kotlin/BuildExtensions.kt | 2 +- .../main/kotlin/io/spine/dependency/Dependency.kt | 14 ++++++++++---- .../main/kotlin/io/spine/dependency/build/Ksp.kt | 3 ++- .../main/kotlin/io/spine/dependency/lib/Kotlin.kt | 4 ++-- .../io/spine/dependency/local/CoreJvmCompiler.kt | 8 ++------ .../kotlin/io/spine/dependency/local/ProtoTap.kt | 2 +- .../kotlin/io/spine/dependency/local/ToolBase.kt | 6 +++--- .../src/main/kotlin/uber-jar-module.gradle.kts | 2 +- 9 files changed, 25 insertions(+), 22 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 5b08359cd..bec73725d 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -38,7 +38,7 @@ plugins { `kotlin-dsl` // https://github.com/jk1/Gradle-License-Report/releases - id("com.github.jk1.dependency-license-report").version("2.7") + id("com.github.jk1.dependency-license-report").version("2.9") } repositories { @@ -75,7 +75,7 @@ val grGitVersion = "4.1.1" * This version may change from the [version of Kotlin][io.spine.dependency.lib.Kotlin.version] * used by the project. */ -val kotlinEmbeddedVersion = "2.2.20" +val kotlinEmbeddedVersion = "2.2.21" /** * The version of Guava used in `buildSrc`. @@ -130,7 +130,7 @@ val kotestJvmPluginVersion = "0.4.10" /** * @see [io.spine.dependency.test.Kotest.MultiplatformGradlePlugin] */ -val kotestMultiplatformPluginVersion = "5.9.1" +val kotestMultiplatformPluginVersion = "6.0.0.M4" /** * @see [io.spine.dependency.test.Kover] diff --git a/buildSrc/src/main/kotlin/BuildExtensions.kt b/buildSrc/src/main/kotlin/BuildExtensions.kt index e92238c26..04c15b52c 100644 --- a/buildSrc/src/main/kotlin/BuildExtensions.kt +++ b/buildSrc/src/main/kotlin/BuildExtensions.kt @@ -164,7 +164,7 @@ val PluginDependenciesSpec.kover: PluginDependencySpec get() = id(Kover.id).version(Kover.version) val PluginDependenciesSpec.ksp: PluginDependencySpec - get() = id(Ksp.id).version(Ksp.version) + get() = id(Ksp.id).version(Ksp.dogfoodingVersion) val PluginDependenciesSpec.`plugin-publish`: PluginDependencySpec get() = id(PluginPublishPlugin.id).version(PluginPublishPlugin.version) diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/Dependency.kt b/buildSrc/src/main/kotlin/io/spine/dependency/Dependency.kt index e9c3197a9..999538fd6 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/Dependency.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/Dependency.kt @@ -63,11 +63,17 @@ abstract class Dependency { } /** - * Obtains full Maven coordinates for the requested [module]. + * Obtains full Maven coordinates for the requested [module] and [version]. */ - fun artifact(module: String): String = artifacts[module] ?: error( - "The dependency `${this::class.simpleName}` does not declare a module `$module`." - ) + fun artifact(module: String, version: String = ""): String { + return if (version.isEmpty()) { + artifacts[module] ?: error( + "The dependency `${this::class.simpleName}` does not declare a module `$module`." + ) + } else { + "$module:$version" + } + } /** * Forces all artifacts of this dependency using the given resolution strategy. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt b/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt index f96ce56f3..b1146e97a 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt @@ -35,7 +35,8 @@ import io.spine.dependency.Dependency */ @Suppress("unused") object Ksp : Dependency() { - override val version = "2.2.20-2.0.4" + override val version = "2.3.0" + val dogfoodingVersion = version override val group = "com.google.devtools.ksp" const val id = "com.google.devtools.ksp" diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt index 0029ab1e3..d2762bdb8 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt @@ -39,7 +39,7 @@ object Kotlin : DependencyWithBom() { * depend on Gradle and the version of embedded Kotlin. */ @Suppress("MemberVisibilityCanBePrivate") // used directly from the outside. - const val runtimeVersion = "2.2.20" + const val runtimeVersion = "2.2.21" override val version = runtimeVersion override val group = "org.jetbrains.kotlin" @@ -49,7 +49,7 @@ object Kotlin : DependencyWithBom() { * This is the version of * [Kotlin embedded into Gradle](https://docs.gradle.org/current/userguide/compatibility.html#kotlin). */ - const val embeddedVersion = "2.2.20" + const val embeddedVersion = "2.2.21" /** * The version of the JetBrains annotations library, which is a transitive diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt index 4a2cd4132..48686cf77 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt @@ -26,10 +26,6 @@ package io.spine.dependency.local -import io.spine.dependency.local.CoreJvmCompiler.dogfoodingVersion -import io.spine.dependency.local.CoreJvmCompiler.version - - /** * Dependencies on the CoreJvm Compiler artifacts. * @@ -50,12 +46,12 @@ object CoreJvmCompiler { /** * The version used to in the build classpath. */ - const val dogfoodingVersion = "2.0.0-SNAPSHOT.017" + const val dogfoodingVersion = "2.0.0-SNAPSHOT.024" /** * The version to be used for integration tests. */ - const val version = "2.0.0-SNAPSHOT.017" + const val version = "2.0.0-SNAPSHOT.024" /** * The ID of the Gradle plugin. diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoTap.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoTap.kt index 813b4cc19..3b4df1009 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoTap.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoTap.kt @@ -38,7 +38,7 @@ package io.spine.dependency.local ) object ProtoTap { const val group = "io.spine.tools" - const val version = "0.13.0" + const val version = "0.14.0" const val gradlePluginId = "io.spine.prototap" const val api = "$group:prototap-api:$version" const val gradlePlugin = "$group:prototap-gradle-plugin:$version" diff --git a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt index 734d1094e..0de77f84b 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt @@ -34,8 +34,8 @@ package io.spine.dependency.local @Suppress("ConstPropertyName", "unused") object ToolBase { const val group = Spine.toolsGroup - const val version = "2.0.0-SNAPSHOT.366" - const val dogfoodingVersion = "2.0.0-SNAPSHOT.361" + const val version = "2.0.0-SNAPSHOT.369" + const val dogfoodingVersion = "2.0.0-SNAPSHOT.369" const val lib = "$group:tool-base:$version" const val classicCodegen = "$group:classic-codegen:$version" @@ -54,7 +54,7 @@ object ToolBase { const val gradlePluginApiTestFixtures = "$group:gradle-plugin-api-test-fixtures:$version" const val jvmTools = "$group:jvm-tools:$version" - const val jvmToolPluginDogfooding = "$group:jvm-tool-all-plugins:$dogfoodingVersion" + const val jvmToolPluginDogfooding = "$group:jvm-tool-plugins-all:$dogfoodingVersion" const val jvmToolPlugins = "$group:jvm-tool-plugins-all:$version" const val protobufSetupPlugins = "$group:protobuf-setup-plugins:$version" diff --git a/buildSrc/src/main/kotlin/uber-jar-module.gradle.kts b/buildSrc/src/main/kotlin/uber-jar-module.gradle.kts index 29dba3c66..f3dda5216 100644 --- a/buildSrc/src/main/kotlin/uber-jar-module.gradle.kts +++ b/buildSrc/src/main/kotlin/uber-jar-module.gradle.kts @@ -33,7 +33,7 @@ import io.spine.gradle.publish.spinePublishing import io.spine.gradle.report.license.LicenseReporter plugins { - `java-library` + id("module") `maven-publish` id("com.gradleup.shadow") id("write-manifest") From 9c68ff3243c3f4bd628b70111d0dcec23386ba99 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 27 Oct 2025 17:51:15 +0000 Subject: [PATCH 4/6] Add template `module` script --- buildSrc/src/main/kotlin/module.gradle.kts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 buildSrc/src/main/kotlin/module.gradle.kts diff --git a/buildSrc/src/main/kotlin/module.gradle.kts b/buildSrc/src/main/kotlin/module.gradle.kts new file mode 100644 index 000000000..6e83dcd83 --- /dev/null +++ b/buildSrc/src/main/kotlin/module.gradle.kts @@ -0,0 +1,31 @@ +/* + * Copyright 2025, TeamDev. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Redistribution and use in source and/or binary forms, with or without + * modification, must retain the above copyright notice and the following + * disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This is a template file for an actual script which should be +// defined by a project to which `config` is applied. +// +// The reason for having this file is that it is referenced as +// a plugin in `uper-jar-module.gradle.kts` From 9b944d8513918a1433ef4da0aa3015dde198e0fb Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 27 Oct 2025 18:00:03 +0000 Subject: [PATCH 5/6] Do not overwrite `module.gradle.kts` on update --- migrate | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/migrate b/migrate index cc051c670..9ccf402da 100755 --- a/migrate +++ b/migrate @@ -92,8 +92,25 @@ rm -f ../.lift.toml rm -f ../license-report.md echo "Updating Gradle \\\`buildSrc\\\`" + +# Preserve an existing project's `module.gradle.kts` (do not overwrite it). +DEST_MODULE="../buildSrc/src/main/kotlin/module.gradle.kts" +PRESERVE_TMP="" +if [ -f "$DEST_MODULE" ]; then + echo "Preserving existing \\\`module.gradle.kts\\\`" + PRESERVE_TMP=$(mktemp) + cp -a "$DEST_MODULE" "$PRESERVE_TMP" +fi + cp -R buildSrc .. +# Restore preserved `module.gradle.kts`, if any. +if [ -n "$PRESERVE_TMP" ] && [ -f "$PRESERVE_TMP" ]; then + echo "Restoring existing \\\`module.gradle.kts\\\`" + cp -a "$PRESERVE_TMP" "$DEST_MODULE" + rm -f "$PRESERVE_TMP" +fi + echo "Updating Gradle Wrapper" cp -R ./gradle .. cp gradlew .. From 6ef36c8385b99ed3d7feac692f4f9326e1fed272 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Mon, 27 Oct 2025 18:08:51 +0000 Subject: [PATCH 6/6] Fix typo in docs --- buildSrc/src/main/kotlin/module.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/module.gradle.kts b/buildSrc/src/main/kotlin/module.gradle.kts index 6e83dcd83..b24b5b2ac 100644 --- a/buildSrc/src/main/kotlin/module.gradle.kts +++ b/buildSrc/src/main/kotlin/module.gradle.kts @@ -28,4 +28,4 @@ // defined by a project to which `config` is applied. // // The reason for having this file is that it is referenced as -// a plugin in `uper-jar-module.gradle.kts` +// a plugin in `uber-jar-module.gradle.kts`