From cd6bb7a9a9673a108670e2ae9482d61742bbf44d Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Wed, 28 May 2025 16:55:55 +0100 Subject: [PATCH 01/11] Bump version -> `2.0.0-SNAPSHOT.008` --- version.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.gradle.kts b/version.gradle.kts index b24e0f5b35..d644292e38 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -32,4 +32,4 @@ * * For dependencies on Spine SDK module please see [io.spine.dependency.local.Spine]. */ -val compilerVersion: String by extra("2.0.0-SNAPSHOT.007") +val compilerVersion: String by extra("2.0.0-SNAPSHOT.008") From 57ca41aed9b20a62706d6dbd052c2f1e6806d7bf Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Thu, 29 May 2025 20:04:59 +0100 Subject: [PATCH 02/11] Rename `CodegenSettings` -> `CompilerSettings` --- .../api/{CodegenSettings.kt => CompilerSettings.kt} | 8 ++++---- .../io/spine/compiler/gradle/api/ProjectExts.kt | 12 +++++++----- .../io/spine/compiler/gradle/plugin/Extension.kt | 4 ++-- .../kotlin/io/spine/compiler/gradle/plugin/Plugin.kt | 8 ++++---- .../io/spine/compiler/gradle/plugin/ExtensionSpec.kt | 4 ++-- 5 files changed, 19 insertions(+), 17 deletions(-) rename gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/{CodegenSettings.kt => CompilerSettings.kt} (90%) diff --git a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/CodegenSettings.kt b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/CompilerSettings.kt similarity index 90% rename from gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/CodegenSettings.kt rename to gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/CompilerSettings.kt index 0c247a42e9..5feb001484 100644 --- a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/CodegenSettings.kt +++ b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/CompilerSettings.kt @@ -29,13 +29,13 @@ package io.spine.compiler.gradle.api import org.gradle.api.file.DirectoryProperty /** - * Configures the code generation process performed by ProtoData. + * Configures the code generation process performed by the Compiler. */ -public interface CodegenSettings { +public interface CompilerSettings { /** - * Passes given names of Java classes to ProtoData as - * the `io.spine.compiler.plugin.Plugin` classes. + * Passes given names of Java classes to the Compiler as classes + * extending the `io.spine.compiler.plugin.Plugin` class. */ public fun plugins(vararg classNames: String) diff --git a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt index e66ac829be..21b7cf3e0b 100644 --- a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt +++ b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt @@ -33,24 +33,26 @@ import java.nio.file.Path import org.gradle.api.file.Directory import org.gradle.api.tasks.SourceSet +//TODO:2025-05-29:alexander.yevsyukov: Nest it under the working directory of the `RootPlugin`. /** * Obtains the directory where ProtoData stores its temporary files. */ public val Project.compilerWorkingDir: Directory get() = layout.buildDirectory.dir(PROTODATA_WORKING_DIR).get() +//TODO:2025-05-29:alexander.yevsyukov: Nest it under the root extension. /** - * Obtains the instance of [CodegenSettings] extension of this project. + * Obtains the instance of [CompilerSettings] extension of this project. */ -public val Project.codegenSettings: CodegenSettings - get() = extensions.findByType(CodegenSettings::class.java)!! +public val Project.compilerSettings: CompilerSettings + get() = extensions.findByType(CompilerSettings::class.java)!! /** * Obtains the path of the directory with the generated code as configured by - * the [CodegenSettings.outputBaseDir] property of the ProtoData extension of this Gradle project. + * the [CompilerSettings.outputBaseDir] property of the ProtoData extension of this Gradle project. */ public val Project.generatedDir: Path - get() = codegenSettings.outputBaseDir.get().asFile.toPath() + get() = compilerSettings.outputBaseDir.get().asFile.toPath() /** * Obtains the `generated` directory for the given [sourceSet] and a language. diff --git a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt index 66334a24d1..3a75ed2335 100644 --- a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt +++ b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt @@ -27,7 +27,7 @@ package io.spine.compiler.gradle.plugin import com.google.common.annotations.VisibleForTesting -import io.spine.compiler.gradle.api.CodegenSettings +import io.spine.compiler.gradle.api.CompilerSettings import io.spine.tools.fs.DirectoryName.generated import io.spine.tools.gradle.protobuf.generatedSourceProtoDir import org.gradle.api.Project @@ -41,7 +41,7 @@ import org.gradle.kotlin.dsl.listProperty /** * The `compiler { }` Gradle project extension. */ -public class Extension(private val project: Project): CodegenSettings { +public class Extension(private val project: Project): CompilerSettings { private val factory = project.objects diff --git a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt index c62f5f0b0b..4c3fb014c8 100644 --- a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt +++ b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt @@ -36,7 +36,7 @@ import com.google.protobuf.gradle.GenerateProtoTask import io.spine.code.proto.DescriptorReference import io.spine.compiler.gradle.api.Artifacts import io.spine.compiler.gradle.api.SpineCompilerCleanTask -import io.spine.compiler.gradle.api.CodegenSettings +import io.spine.compiler.gradle.api.CompilerSettings import io.spine.compiler.gradle.api.CompilerTask import io.spine.compiler.gradle.api.Names.COMPILER_RAW_ARTIFACT import io.spine.compiler.gradle.api.Names.EXTENSION_NAME @@ -134,18 +134,18 @@ public class Plugin : GradlePlugin { * Or, if the extension is not yet added, creates it and returns. */ internal val Project.extension: Extension - get() = extensions.findByType(CodegenSettings::class)?.run { this as Extension } + get() = extensions.findByType(CompilerSettings::class)?.run { this as Extension } ?: createExtension() /** * Creates [Extension] associated with [Plugin] in this project. * - * The extension is exposed by the type of [CodegenSettings] it implements to hide + * The extension is exposed by the type of [CompilerSettings] it implements to hide * the implementation details from the end-user projects. */ private fun Project.createExtension(): Extension { val extension = Extension(this) - extensions.add(CodegenSettings::class.java, EXTENSION_NAME, extension) + extensions.add(CompilerSettings::class.java, EXTENSION_NAME, extension) return extension } diff --git a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt index 06b0d44bf8..bafd44d843 100644 --- a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt +++ b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt @@ -29,7 +29,7 @@ package io.spine.compiler.gradle.plugin import com.google.common.truth.Truth.assertThat import com.google.protobuf.gradle.ProtobufPlugin import io.kotest.matchers.shouldBe -import io.spine.compiler.gradle.api.CodegenSettings +import io.spine.compiler.gradle.api.CompilerSettings import io.spine.tools.gradle.project.sourceSets import java.io.File import kotlin.io.path.div @@ -62,7 +62,7 @@ class ExtensionSpec { apply() apply() - this@ExtensionSpec.extension = extensions.getByType() as Extension + this@ExtensionSpec.extension = extensions.getByType() as Extension } } From 9997c7b0f52b910d995699d28584db731bbd9680 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Thu, 29 May 2025 20:05:06 +0100 Subject: [PATCH 03/11] Rename `CodegenSettings` -> `CompilerSettings` --- tests/consumer/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/consumer/build.gradle.kts b/tests/consumer/build.gradle.kts index 3994114232..34626d3e6f 100644 --- a/tests/consumer/build.gradle.kts +++ b/tests/consumer/build.gradle.kts @@ -29,7 +29,7 @@ import io.spine.dependency.lib.JavaX import io.spine.dependency.local.Base import io.spine.dependency.local.Spine -import io.spine.compiler.gradle.api.CodegenSettings +import io.spine.compiler.gradle.api.CompilerSettings buildscript { standardSpineSdkRepositories() @@ -50,7 +50,7 @@ dependencies { testImplementation(Base.lib)?.because("tests use packing and unpacking extension functions.") } -extensions.getByType().apply { +extensions.getByType().apply { plugins( "io.spine.compiler.test.uuid.UuidPlugin", "io.spine.compiler.test.annotation.AnnotationPlugin" From 4f5e5d030b11a67328cbbe6f1d714f5159fc8e8e Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Thu, 29 May 2025 20:05:21 +0100 Subject: [PATCH 04/11] Update dependency reports --- dependencies.md | 44 ++++++++++++++++++++++---------------------- pom.xml | 10 +++++----- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/dependencies.md b/dependencies.md index 0d2de0d950..e0d46881e0 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.compiler:api:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:api:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -1046,12 +1046,12 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:api-tests:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:api-tests:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : org.jetbrains. **Name** : annotations. **Version** : 13.0. @@ -1836,12 +1836,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:backend:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:backend:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -2887,12 +2887,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:cli:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:cli:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -3962,12 +3962,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:gradle-api:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:gradle-api:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -4948,12 +4948,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:gradle-plugin:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:gradle-plugin:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -5982,12 +5982,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:jvm:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:jvm:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -7033,12 +7033,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:params:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:params:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -8076,12 +8076,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:protoc-plugin:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:protoc-plugin:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -8884,12 +8884,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:test-env:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:test-env:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -9931,12 +9931,12 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). -# Dependencies of `io.spine.compiler:testlib:2.0.0-SNAPSHOT.007` +# Dependencies of `io.spine.compiler:testlib:2.0.0-SNAPSHOT.008` ## Runtime 1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.18.3. @@ -11080,4 +11080,4 @@ This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue May 27 20:07:11 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 8922ba4bb7..40a76192fb 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine.compiler spine-compiler -2.0.0-SNAPSHOT.007 +2.0.0-SNAPSHOT.008 2015 @@ -134,19 +134,19 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-plugin-base - 2.0.0-SNAPSHOT.333 + 2.0.0-SNAPSHOT.334 compile io.spine.tools spine-psi-java - 2.0.0-SNAPSHOT.333 + 2.0.0-SNAPSHOT.334 compile io.spine.tools spine-tool-base - 2.0.0-SNAPSHOT.333 + 2.0.0-SNAPSHOT.334 compile @@ -218,7 +218,7 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-plugin-testlib - 2.0.0-SNAPSHOT.333 + 2.0.0-SNAPSHOT.334 test From 53daafda72150c9556d715c964719b92d58c6b26 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Fri, 30 May 2025 19:13:04 +0100 Subject: [PATCH 05/11] Bump ToolBase -> `2.0.0-SNAPSHOT.334` --- buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 eaf5c44776..6d672bdb76 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt @@ -34,7 +34,7 @@ package io.spine.dependency.local @Suppress("ConstPropertyName", "unused") object ToolBase { const val group = Spine.toolsGroup - const val version = "2.0.0-SNAPSHOT.333" + const val version = "2.0.0-SNAPSHOT.334" const val lib = "$group:spine-tool-base:$version" const val pluginBase = "$group:spine-plugin-base:$version" From 0608451ec0fbae8fd3b99873a381c99003f14b80 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Fri, 30 May 2025 19:49:28 +0100 Subject: [PATCH 06/11] Put the Compiler working dir under `rootWorkingDir` --- .../io/spine/dependency/local/ToolBase.kt | 2 ++ gradle-api/build.gradle.kts | 1 + .../spine/compiler/gradle/api/ProjectExts.kt | 19 ++++++++++++++----- .../params/CodeGeneratorRequestFile.kt | 4 ++-- .../io/spine/compiler/params/Directories.kt | 12 ++++++------ 5 files changed, 25 insertions(+), 13 deletions(-) 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 6d672bdb76..1a1466cd80 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt @@ -38,6 +38,8 @@ object ToolBase { const val lib = "$group:spine-tool-base:$version" const val pluginBase = "$group:spine-plugin-base:$version" + const val gradleRootPlugin = "$group:spine-gradle-root-plugin:$version" + const val gradlePluginApi = "$group:spine-gradle-plugin-api:$version" const val pluginTestlib = "$group:spine-plugin-testlib:$version" const val intellijPlatformJava = "$group:intellij-platform-java:$version" diff --git a/gradle-api/build.gradle.kts b/gradle-api/build.gradle.kts index d0689f8403..7ffc5045d0 100644 --- a/gradle-api/build.gradle.kts +++ b/gradle-api/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { compileOnly(gradleApi()) implementation(ToolBase.pluginBase) + implementation(ToolBase.gradlePluginApi) implementation(project(":api")) implementation(project(":params")) diff --git a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt index 21b7cf3e0b..541fb48c57 100644 --- a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt +++ b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt @@ -27,25 +27,34 @@ package io.spine.compiler.gradle.api import org.gradle.api.Project -import io.spine.compiler.params.Directories.PROTODATA_WORKING_DIR +import io.spine.compiler.params.Directories.COMPILER_WORKING_DIR +import io.spine.tools.gradle.root.rootExtension import java.io.File import java.nio.file.Path import org.gradle.api.file.Directory import org.gradle.api.tasks.SourceSet +import io.spine.tools.gradle.root.rootWorkingDir -//TODO:2025-05-29:alexander.yevsyukov: Nest it under the working directory of the `RootPlugin`. /** * Obtains the directory where ProtoData stores its temporary files. */ public val Project.compilerWorkingDir: Directory - get() = layout.buildDirectory.dir(PROTODATA_WORKING_DIR).get() + get() = rootWorkingDir.dir(COMPILER_WORKING_DIR) -//TODO:2025-05-29:alexander.yevsyukov: Nest it under the root extension. /** * Obtains the instance of [CompilerSettings] extension of this project. */ public val Project.compilerSettings: CompilerSettings - get() = extensions.findByType(CompilerSettings::class.java)!! + get() { + // Compatibility mode for the migration phase. + val type = CompilerSettings::class.java + val underProject = extensions.findByType(type) + underProject?.let { return it } + + // The new DSL: `spine { compiler { ... } }` + val underRootExt = rootExtension.extensions.findByType(type) + return underRootExt!! + } /** * Obtains the path of the directory with the generated code as configured by diff --git a/params/src/main/kotlin/io/spine/compiler/params/CodeGeneratorRequestFile.kt b/params/src/main/kotlin/io/spine/compiler/params/CodeGeneratorRequestFile.kt index 26dbf32311..8efd63d6cc 100644 --- a/params/src/main/kotlin/io/spine/compiler/params/CodeGeneratorRequestFile.kt +++ b/params/src/main/kotlin/io/spine/compiler/params/CodeGeneratorRequestFile.kt @@ -26,7 +26,7 @@ package io.spine.compiler.params -import io.spine.compiler.params.Directories.PROTODATA_WORKING_DIR +import io.spine.compiler.params.Directories.COMPILER_WORKING_DIR import io.spine.compiler.params.Directories.REQUESTS_SUBDIR import io.spine.tools.code.SourceSetName @@ -40,7 +40,7 @@ public object CodeGeneratorRequestFile { * request files are placed. */ @Suppress("ConstPropertyName") // https://bit.ly/kotlin-prop-names - public const val defaultDirectory: String = "$PROTODATA_WORKING_DIR/$REQUESTS_SUBDIR" + public const val defaultDirectory: String = "$COMPILER_WORKING_DIR/$REQUESTS_SUBDIR" /** * Obtains the name of the file with the code generation request for the given source set. diff --git a/params/src/main/kotlin/io/spine/compiler/params/Directories.kt b/params/src/main/kotlin/io/spine/compiler/params/Directories.kt index 9456eca436..e136e4e380 100644 --- a/params/src/main/kotlin/io/spine/compiler/params/Directories.kt +++ b/params/src/main/kotlin/io/spine/compiler/params/Directories.kt @@ -32,25 +32,25 @@ package io.spine.compiler.params public object Directories { /** - * The name of the ProtoData working directory which is conventionally - * placed under the `build` directory. + * The name of the Compiler working directory which is conventionally + * placed under the `build/spine` directory. */ - public const val PROTODATA_WORKING_DIR: String = "protodata" + public const val COMPILER_WORKING_DIR: String = "compiler" /** - * The name of the subdirectory under [PROTODATA_WORKING_DIR] for storing + * The name of the subdirectory under [COMPILER_WORKING_DIR] for storing * files passed as parameters to pipelines. */ public const val PARAMETERS_SUBDIR: String = "parameters" /** - * The name of the subdirectory under [PROTODATA_WORKING_DIR] where + * The name of the subdirectory under [COMPILER_WORKING_DIR] where * the ProtoData settings files are stored. */ public const val SETTINGS_SUBDIR: String = "settings" /** - * The name of the subdirectory under [PROTODATA_WORKING_DIR] where + * The name of the subdirectory under [COMPILER_WORKING_DIR] where * [code generation requests files][CodeGeneratorRequestFile] are stored. */ public const val REQUESTS_SUBDIR: String = "requests" From 9d6d58fc1d795d9ecf8043cad0d4f6ba5e5c014c Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Fri, 30 May 2025 19:49:37 +0100 Subject: [PATCH 07/11] Update dependency reports --- dependencies.md | 22 +++++++++++----------- pom.xml | 6 ++++++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/dependencies.md b/dependencies.md index e0d46881e0..2bffb2bf32 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1046,7 +1046,7 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -1836,7 +1836,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -2887,7 +2887,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -3962,7 +3962,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -4948,7 +4948,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -5982,7 +5982,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -7033,7 +7033,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8076,7 +8076,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8884,7 +8884,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -9931,7 +9931,7 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -11080,4 +11080,4 @@ This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Thu May 29 20:04:09 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 40a76192fb..9198e7192a 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,12 @@ all modules and does not describe the project structure per-subproject. 0.10.0 compile + + io.spine.tools + spine-gradle-plugin-api + 2.0.0-SNAPSHOT.334 + compile + io.spine.tools spine-plugin-base From 15b12550c350b7bb8ab2ce4f0c017c02b758e94d Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 3 Jun 2025 17:33:24 +0100 Subject: [PATCH 08/11] Nest `compiler` under `spine` Also: * Create compiler extension using `DslSpec` descendant. * Rename `Project.extension` to `compilerSettings`. * Bump ToolBase -> `2.0.0-SNAPSHOT.335` --- .../io/spine/dependency/local/ToolBase.kt | 2 +- .../spine/compiler/gradle/api/ProjectExts.kt | 17 ++--- gradle-plugin/build.gradle.kts | 7 ++- .../android-library/build.gradle.kts | 12 ++-- .../resources/empty-test/build.gradle.kts | 12 ++-- .../java-kotlin-test/build.gradle.kts | 12 ++-- .../java-library-kotlin-jvm/build.gradle.kts | 12 ++-- .../resources/kotlin-test/build.gradle.kts | 12 ++-- .../resources/launch-test/build.gradle.kts | 12 ++-- .../with-functional-test/build.gradle.kts | 12 ++-- .../spine/compiler/gradle/plugin/Extension.kt | 23 +++++++ .../gradle/plugin/LaunchSpineCompiler.kt | 2 +- .../io/spine/compiler/gradle/plugin/Plugin.kt | 63 +++++++++---------- .../compiler/gradle/plugin/ExtensionSpec.kt | 4 +- .../gradle/plugin/ProjectConfigSpec.kt | 15 ++--- tests/consumer/build.gradle.kts | 3 +- tests/in-place-consumer/build.gradle.kts | 12 ++-- 17 files changed, 132 insertions(+), 100 deletions(-) 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 1a1466cd80..643c107796 100644 --- a/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt +++ b/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt @@ -34,7 +34,7 @@ package io.spine.dependency.local @Suppress("ConstPropertyName", "unused") object ToolBase { const val group = Spine.toolsGroup - const val version = "2.0.0-SNAPSHOT.334" + const val version = "2.0.0-SNAPSHOT.335" const val lib = "$group:spine-tool-base:$version" const val pluginBase = "$group:spine-plugin-base:$version" diff --git a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt index 541fb48c57..253693a265 100644 --- a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt +++ b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/ProjectExts.kt @@ -26,14 +26,14 @@ package io.spine.compiler.gradle.api -import org.gradle.api.Project import io.spine.compiler.params.Directories.COMPILER_WORKING_DIR -import io.spine.tools.gradle.root.rootExtension +import io.spine.tools.gradle.lib.spineExtension +import io.spine.tools.gradle.root.rootWorkingDir import java.io.File import java.nio.file.Path +import org.gradle.api.Project import org.gradle.api.file.Directory import org.gradle.api.tasks.SourceSet -import io.spine.tools.gradle.root.rootWorkingDir /** * Obtains the directory where ProtoData stores its temporary files. @@ -45,16 +45,7 @@ public val Project.compilerWorkingDir: Directory * Obtains the instance of [CompilerSettings] extension of this project. */ public val Project.compilerSettings: CompilerSettings - get() { - // Compatibility mode for the migration phase. - val type = CompilerSettings::class.java - val underProject = extensions.findByType(type) - underProject?.let { return it } - - // The new DSL: `spine { compiler { ... } }` - val underRootExt = rootExtension.extensions.findByType(type) - return underRootExt!! - } + get() = spineExtension() /** * Obtains the path of the directory with the generated code as configured by diff --git a/gradle-plugin/build.gradle.kts b/gradle-plugin/build.gradle.kts index 281f10b21b..d662dee63b 100644 --- a/gradle-plugin/build.gradle.kts +++ b/gradle-plugin/build.gradle.kts @@ -72,13 +72,14 @@ testing { } dependencies { - api(project(":gradle-api")) - compileOnly(gradleApi()) compileOnly(gradleKotlinDsl()) compileOnly(Protobuf.GradlePlugin.lib) compileOnly(Kotlin.GradlePlugin.api) + api(project(":gradle-api")) + api(ToolBase.gradlePluginApi) + implementation(project(":api")) implementation(project(":params")) implementation(ToolBase.lib) @@ -89,6 +90,7 @@ dependencies { * Make functional tests depend on publishing all the submodules to Maven Local so that * the Gradle plugin can get all the dependencies when it's applied to the test projects. */ +@Suppress("unused") val functionalTest: Task by tasks.getting { val task = this productionModules.forEach { subproject -> @@ -108,6 +110,7 @@ val publishPlugins: Task by tasks.getting { enabled = !isSnapshot } +@Suppress("unused") val publish: Task by tasks.getting { if (!isSnapshot) { dependsOn(publishPlugins) diff --git a/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts index df54a9a70a..c7ff9d9da6 100644 --- a/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts @@ -42,11 +42,13 @@ repositories { standardToSpineSdk() } -compiler { - plugins( - "io.spine.compiler.test.UnderscorePrefixRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.UnderscorePrefixRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } dependencies { diff --git a/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts index ebfdfc1fd7..0b648083ab 100644 --- a/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts @@ -53,9 +53,11 @@ protobuf { } } -compiler { - plugins( - "io.spine.compiler.test.UnderscorePrefixRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.UnderscorePrefixRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } diff --git a/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts index a28adcaef1..20100bb8f0 100644 --- a/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts @@ -44,11 +44,13 @@ repositories { standardToSpineSdk() } -compiler { - plugins( - "io.spine.compiler.test.NoOpRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.NoOpRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } dependencies { diff --git a/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts index 2113888d92..1a315b05fb 100644 --- a/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts @@ -44,11 +44,13 @@ repositories { standardToSpineSdk() } -compiler { - plugins( - "io.spine.compiler.test.NoOpRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.NoOpRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } dependencies { diff --git a/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts index ee665034b0..84f0779910 100644 --- a/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts @@ -43,11 +43,13 @@ repositories { standardToSpineSdk() } -compiler { - plugins( - "io.spine.compiler.test.NoOpRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.NoOpRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } dependencies { diff --git a/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts index ebfdfc1fd7..0b648083ab 100644 --- a/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts @@ -53,9 +53,11 @@ protobuf { } } -compiler { - plugins( - "io.spine.compiler.test.UnderscorePrefixRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.UnderscorePrefixRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } diff --git a/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts index c62988e31c..eec414cf3d 100644 --- a/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts @@ -45,11 +45,13 @@ repositories { standardToSpineSdk() } -compiler { - plugins( - "io.spine.compiler.test.NoOpRendererPlugin", - "io.spine.compiler.test.TestPlugin" - ) +spine { + compiler { + plugins( + "io.spine.compiler.test.NoOpRendererPlugin", + "io.spine.compiler.test.TestPlugin" + ) + } } dependencies { diff --git a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt index 3a75ed2335..a6e18d47e2 100644 --- a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt +++ b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Extension.kt @@ -28,11 +28,14 @@ package io.spine.compiler.gradle.plugin import com.google.common.annotations.VisibleForTesting import io.spine.compiler.gradle.api.CompilerSettings +import io.spine.compiler.gradle.api.Names.EXTENSION_NAME import io.spine.tools.fs.DirectoryName.generated +import io.spine.tools.gradle.DslSpec import io.spine.tools.gradle.protobuf.generatedSourceProtoDir import org.gradle.api.Project import org.gradle.api.file.Directory import org.gradle.api.file.DirectoryProperty +import org.gradle.api.plugins.ExtensionContainer import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Provider import org.gradle.api.tasks.SourceSet @@ -145,3 +148,23 @@ public class Extension(private val project: Project): CompilerSettings { ) } } + +/** + * Overrides [DslSpec] for customizing creation of the [Extension]. + */ +internal class CompilerDslSpec : + DslSpec(EXTENSION_NAME, CompilerSettings::class) { + + /** + * The function for obtaining a project to which the [Plugin] is applied. + * + * This property is injected at the [Plugin] constructor. + */ + internal lateinit var project: () -> Project + + override fun createIn(container: ExtensionContainer): CompilerSettings { + val extension = Extension(project()) + container.add(extensionClass.java, name, extension) + return extension + } +} diff --git a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/LaunchSpineCompiler.kt b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/LaunchSpineCompiler.kt index 6431386dbf..86c803a3ff 100644 --- a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/LaunchSpineCompiler.kt +++ b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/LaunchSpineCompiler.kt @@ -172,7 +172,7 @@ public abstract class LaunchSpineCompiler : JavaExec() { internal fun LaunchSpineCompiler.applyDefaults(sourceSet: SourceSet) { sourceSetName.set(sourceSet.name) val project = project - val ext = project.extension + val ext = project.compilerSettings plugins = ext.plugins compilerConfiguration = project.compilerRawArtifact userClasspathConfiguration = project.userClasspath diff --git a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt index 4c3fb014c8..e74a83068f 100644 --- a/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt +++ b/gradle-plugin/src/main/kotlin/io/spine/compiler/gradle/plugin/Plugin.kt @@ -35,15 +35,14 @@ import com.google.errorprone.annotations.CanIgnoreReturnValue import com.google.protobuf.gradle.GenerateProtoTask import io.spine.code.proto.DescriptorReference import io.spine.compiler.gradle.api.Artifacts -import io.spine.compiler.gradle.api.SpineCompilerCleanTask import io.spine.compiler.gradle.api.CompilerSettings import io.spine.compiler.gradle.api.CompilerTask import io.spine.compiler.gradle.api.Names.COMPILER_RAW_ARTIFACT -import io.spine.compiler.gradle.api.Names.EXTENSION_NAME import io.spine.compiler.gradle.api.Names.PROTOBUF_GRADLE_PLUGIN_ID import io.spine.compiler.gradle.api.Names.SPINE_COMPILER_PROTOC_PLUGIN import io.spine.compiler.gradle.api.Names.USER_CLASSPATH_CONFIGURATION import io.spine.compiler.gradle.api.ProtocPluginArtifact +import io.spine.compiler.gradle.api.SpineCompilerCleanTask import io.spine.compiler.gradle.api.compilerWorkingDir import io.spine.compiler.gradle.api.generatedDir import io.spine.compiler.gradle.plugin.GeneratedSubdir.GRPC @@ -53,6 +52,8 @@ import io.spine.compiler.params.WorkingDirectory import io.spine.string.toBase64Encoded import io.spine.tools.code.SourceSetName import io.spine.tools.code.manifest.Version +import io.spine.tools.gradle.lib.LibraryPlugin +import io.spine.tools.gradle.lib.spineExtension import io.spine.tools.gradle.project.hasJava import io.spine.tools.gradle.project.hasJavaOrKotlin import io.spine.tools.gradle.project.hasKotlin @@ -70,43 +71,54 @@ import org.gradle.api.tasks.Delete import org.gradle.api.tasks.SourceSet import org.gradle.api.tasks.TaskProvider import org.gradle.kotlin.dsl.exclude -import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.register -import org.gradle.api.Plugin as GradlePlugin /** - * The ProtoData Gradle plugin. + * The Gradle plugin of the Spine Compiler. * - * Adds the `launchProtoData` task which runs the executable with the arguments assembled from - * the configuration of this plugin. + * Adds the `launchSpineCompiler` tasks which runs the executable with the arguments + * assembled from settings of this plugin. * * The users can submit configuration parameters, such as renderer and plugin class names, etc. via - * the `protoData { }` extension. + * the `compiler { }` extension. * - * The users can submit the user classpath to the ProtoData by declaring dependencies using - * the `protoData` configuration. + * The users can submit the user classpath to the Compiler by declaring dependencies using + * the `spineCompiler` configuration. * * Example: * ``` - * protoData { - * renderers("com.acme.MyRenderer") - * plugins("com.acme.MyPlugin") + * spine { + * compiler { + * plugins("com.acme.MyPlugin") + * } * } * * dependencies { - * protoData(project(":my-plugin")) + * spineCompiler(project(":my-plugin")) * } * ``` */ -public class Plugin : GradlePlugin { +public class Plugin : LibraryPlugin( + CompilerDslSpec() +) { + + init { + // Inject the access to the project so that `CompilerDslSpec` can + // create an instance of `Extension`. + (dslSpec as CompilerDslSpec).project = { this.project } + } + /** + * The version of the plugin. + */ private val version: String by lazy { readVersion() } override fun apply(project: Project) { + super.apply(project) + createExtension() with(project) { - createExtension() createConfigurations(this@Plugin.version) createTasks() configureWithProtobufPlugin(this@Plugin.version) @@ -133,21 +145,8 @@ public class Plugin : GradlePlugin { * * Or, if the extension is not yet added, creates it and returns. */ -internal val Project.extension: Extension - get() = extensions.findByType(CompilerSettings::class)?.run { this as Extension } - ?: createExtension() - -/** - * Creates [Extension] associated with [Plugin] in this project. - * - * The extension is exposed by the type of [CompilerSettings] it implements to hide - * the implementation details from the end-user projects. - */ -private fun Project.createExtension(): Extension { - val extension = Extension(this) - extensions.add(CompilerSettings::class.java, EXTENSION_NAME, extension) - return extension -} +internal val Project.compilerSettings: Extension + get() = spineExtension() as Extension /** * Creates configurations for `protoDataRawArtifact` and user-defined classpath, @@ -205,7 +204,7 @@ private fun Project.createCleanTask(sourceSet: SourceSet) { val project = this val cleanSourceSet = SpineCompilerCleanTask.nameFor(sourceSet) tasks.register(cleanSourceSet) { - delete(extension.outputDirs(sourceSet)) + delete(compilerSettings.outputDirs(sourceSet)) val spineCompilerCleanTask = this tasks.getByName("clean").dependsOn(spineCompilerCleanTask) diff --git a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt index bafd44d843..b70f9dc110 100644 --- a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt +++ b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ExtensionSpec.kt @@ -29,7 +29,6 @@ package io.spine.compiler.gradle.plugin import com.google.common.truth.Truth.assertThat import com.google.protobuf.gradle.ProtobufPlugin import io.kotest.matchers.shouldBe -import io.spine.compiler.gradle.api.CompilerSettings import io.spine.tools.gradle.project.sourceSets import java.io.File import kotlin.io.path.div @@ -37,7 +36,6 @@ import org.gradle.api.Project import org.gradle.api.file.Directory import org.gradle.api.tasks.SourceSet.MAIN_SOURCE_SET_NAME import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.getByType import org.gradle.testfixtures.ProjectBuilder import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.DisplayName @@ -62,7 +60,7 @@ class ExtensionSpec { apply() apply() - this@ExtensionSpec.extension = extensions.getByType() as Extension + this@ExtensionSpec.extension = project.compilerSettings } } diff --git a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt index f5dba99835..1c2e779826 100644 --- a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt +++ b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt @@ -29,8 +29,9 @@ package io.spine.compiler.gradle.plugin import com.google.common.truth.Correspondence import com.google.common.truth.Truth.assertThat import com.google.protobuf.gradle.ProtobufPlugin +import io.kotest.matchers.shouldNotBe import io.spine.compiler.gradle.api.CompilerTaskName -import io.spine.compiler.gradle.api.Names.EXTENSION_NAME +import io.spine.compiler.gradle.api.compilerSettings import io.spine.tools.code.SourceSetName import io.spine.tools.gradle.project.sourceSets import java.io.File @@ -43,6 +44,7 @@ import org.gradle.testfixtures.ProjectBuilder import org.junit.jupiter.api.BeforeAll import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.io.TempDir @DisplayName("Plugin configuration should") @@ -89,15 +91,14 @@ class ProjectConfigSpec { @Test fun `add extension`() { - val assertExtension = assertThat(project.extensions.getByName(EXTENSION_NAME)) - assertExtension - .isNotNull() - assertExtension - .isInstanceOf(Extension::class.java) + assertDoesNotThrow { + project.compilerSettings + } + project.compilerSettings shouldNotBe null } @Test - fun `bind 'launchProtoData' to Java compilation`() { + fun `bind 'launchSpineCompiler' to Java compilation`() { val task = project.tasks.getByName("compileJava") assertThat(task.dependsOn) .comparingElementsUsing(taskNames) diff --git a/tests/consumer/build.gradle.kts b/tests/consumer/build.gradle.kts index 34626d3e6f..2937066ff5 100644 --- a/tests/consumer/build.gradle.kts +++ b/tests/consumer/build.gradle.kts @@ -30,6 +30,7 @@ import io.spine.dependency.lib.JavaX import io.spine.dependency.local.Base import io.spine.dependency.local.Spine import io.spine.compiler.gradle.api.CompilerSettings +import io.spine.tools.gradle.root.rootExtension buildscript { standardSpineSdkRepositories() @@ -50,7 +51,7 @@ dependencies { testImplementation(Base.lib)?.because("tests use packing and unpacking extension functions.") } -extensions.getByType().apply { +rootExtension.extensions.getByType().apply { plugins( "io.spine.compiler.test.uuid.UuidPlugin", "io.spine.compiler.test.annotation.AnnotationPlugin" diff --git a/tests/in-place-consumer/build.gradle.kts b/tests/in-place-consumer/build.gradle.kts index 1f4c2090c1..c3406defca 100644 --- a/tests/in-place-consumer/build.gradle.kts +++ b/tests/in-place-consumer/build.gradle.kts @@ -46,9 +46,11 @@ dependencies { val protobufDir = "$projectDir/proto-gen/" -compiler { - plugins( - "io.spine.compiler.test.uuid.UuidPlugin" - ) - outputBaseDir.set(project.layout.projectDirectory.dir(protobufDir)) +spine { + compiler { + plugins( + "io.spine.compiler.test.uuid.UuidPlugin" + ) + outputBaseDir.set(project.layout.projectDirectory.dir(protobufDir)) + } } From eb38f87e308d00c3f4a418dcd0d3e6ba82aa9433 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 3 Jun 2025 17:33:36 +0100 Subject: [PATCH 09/11] Update dependency reports --- dependencies.md | 22 +++++++++++----------- pom.xml | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dependencies.md b/dependencies.md index 2bffb2bf32..51672c2b23 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1046,7 +1046,7 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -1836,7 +1836,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -2887,7 +2887,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -3962,7 +3962,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -4948,7 +4948,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -5982,7 +5982,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -7033,7 +7033,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8076,7 +8076,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8884,7 +8884,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -9931,7 +9931,7 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -11080,4 +11080,4 @@ This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri May 30 19:46:38 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9198e7192a..e31e07fa88 100644 --- a/pom.xml +++ b/pom.xml @@ -134,25 +134,25 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-gradle-plugin-api - 2.0.0-SNAPSHOT.334 + 2.0.0-SNAPSHOT.335 compile io.spine.tools spine-plugin-base - 2.0.0-SNAPSHOT.334 + 2.0.0-SNAPSHOT.335 compile io.spine.tools spine-psi-java - 2.0.0-SNAPSHOT.334 + 2.0.0-SNAPSHOT.335 compile io.spine.tools spine-tool-base - 2.0.0-SNAPSHOT.334 + 2.0.0-SNAPSHOT.335 compile @@ -224,7 +224,7 @@ all modules and does not describe the project structure per-subproject. io.spine.tools spine-plugin-testlib - 2.0.0-SNAPSHOT.334 + 2.0.0-SNAPSHOT.335 test From 4b78f2a182a509d6ce53352e28f0cabb4a800222 Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 3 Jun 2025 18:16:58 +0100 Subject: [PATCH 10/11] Rename template variables --- .../io/spine/compiler/gradle/api/Names.kt | 2 +- .../compiler/gradle/plugin/PluginSpec.kt | 88 +++++++++---------- .../android-library/build.gradle.kts | 2 +- .../resources/copy-grpc/build.gradle.kts | 2 +- .../resources/empty-test/build.gradle.kts | 2 +- .../java-kotlin-test/build.gradle.kts | 2 +- .../java-library-kotlin-jvm/build.gradle.kts | 2 +- .../resources/kotlin-test/build.gradle.kts | 2 +- .../resources/launch-test/build.gradle.kts | 2 +- .../with-functional-test/build.gradle.kts | 2 +- .../gradle/plugin/ProjectConfigSpec.kt | 1 - 11 files changed, 53 insertions(+), 54 deletions(-) diff --git a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/Names.kt b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/Names.kt index 0eaa4e454d..51a8e12d56 100644 --- a/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/Names.kt +++ b/gradle-api/src/main/kotlin/io/spine/compiler/gradle/api/Names.kt @@ -27,7 +27,7 @@ package io.spine.compiler.gradle.api /** - * The name of various objects in ProtoData Gradle API. + * The name of various objects in Spine Compiler Gradle API. */ public object Names { diff --git a/gradle-plugin/src/functionalTest/kotlin/io/spine/compiler/gradle/plugin/PluginSpec.kt b/gradle-plugin/src/functionalTest/kotlin/io/spine/compiler/gradle/plugin/PluginSpec.kt index 64a14c89c7..9ee5cb2f82 100644 --- a/gradle-plugin/src/functionalTest/kotlin/io/spine/compiler/gradle/plugin/PluginSpec.kt +++ b/gradle-plugin/src/functionalTest/kotlin/io/spine/compiler/gradle/plugin/PluginSpec.kt @@ -76,6 +76,49 @@ class PluginSpec { generatedKotlinDir = generatedMainDir.resolve("kotlin") } + private fun createProject(resourceDir: String) { + val version = Plugin.readVersion() + val builder = GradleProject.setupAt(projectDir) + .fromResources(resourceDir) + .withSharedTestKitDirectory() + .replace("@COMPILER_PLUGIN_ID@", GRADLE_PLUGIN_ID) + .replace("@COMPILER_VERSION@", version) + .withLoggingLevel(LogLevel.INFO) + /* Uncomment the following if you need to debug the build process. + Please note that: + 1) Test will run much slower. + 2) Under Windows it may cause this issue to occur: + https://github.com/gradle/native-platform/issues/274 + After finishing the debug, please comment out this call again. */ + //.enableRunnerDebug() + .copyBuildSrc() + project = builder.create() + (project.runner as DefaultGradleRunner).withJvmArguments( + "-Xmx8g", + "-XX:MaxMetaspaceSize=1512m", + "-XX:+UseParallelGC", + "-XX:+HeapDumpOnOutOfMemoryError" + ) + } + + private fun createEmptyProject() { + createProject("empty-test") + } + + private fun createLaunchTestProject() { + createProject("launch-test") + } + + private fun launchAndExpectResult(expected: TaskOutcome) { + val result = launch() + + val outcome = result[launchSpineCompiler] + outcome shouldBe expected + } + + private fun launch(): BuildResult = + project.executeTask(launchSpineCompiler) + /** * Since there are no `proto` files in this project, the request file is * not created, resulting in the [SKIPPED] status of the [launchSpineCompiler] task. @@ -87,7 +130,7 @@ class PluginSpec { } @Test - fun `launch ProtoData`() { + fun `launch the compiler task`() { createLaunchTestProject() launchAndExpectResult(SUCCESS) } @@ -168,49 +211,6 @@ class PluginSpec { assertExists(generatedGrpcDir) assertExists(generatedGrpcDir.resolve(serviceClass)) } - - private fun createEmptyProject() { - createProject("empty-test") - } - - private fun createLaunchTestProject() { - createProject("launch-test") - } - - private fun launchAndExpectResult(expected: TaskOutcome) { - val result = launch() - - val outcome = result[launchSpineCompiler] - outcome shouldBe expected - } - - private fun launch(): BuildResult = - project.executeTask(launchSpineCompiler) - - private fun createProject(resourceDir: String) { - val version = Plugin.readVersion() - val builder = GradleProject.setupAt(projectDir) - .fromResources(resourceDir) - .withSharedTestKitDirectory() - .replace("@PROTODATA_PLUGIN_ID@", GRADLE_PLUGIN_ID) - .replace("@PROTODATA_VERSION@", version) - .withLoggingLevel(LogLevel.INFO) - /* Uncomment the following if you need to debug the build process. - Please note that: - 1) Test will run much slower. - 2) Under Windows it may cause this issue to occur: - https://github.com/gradle/native-platform/issues/274 - After finishing the debug, please comment out this call again. */ - //.enableRunnerDebug() - .copyBuildSrc() - project = builder.create() - (project.runner as DefaultGradleRunner).withJvmArguments( - "-Xmx8g", - "-XX:MaxMetaspaceSize=1512m", - "-XX:+UseParallelGC", - "-XX:+HeapDumpOnOutOfMemoryError" - ) - } } /** diff --git a/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts index c7ff9d9da6..5bbbed6a1a 100644 --- a/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/android-library/build.gradle.kts @@ -34,7 +34,7 @@ buildscript { plugins { id("com.android.library") version "7.3.0" // Protobuf needs it to run. id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/copy-grpc/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/copy-grpc/build.gradle.kts index b64e0c05d7..0d9396b66f 100644 --- a/gradle-plugin/src/functionalTest/resources/copy-grpc/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/copy-grpc/build.gradle.kts @@ -37,7 +37,7 @@ plugins { java kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts index 0b648083ab..51c0da3211 100644 --- a/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/empty-test/build.gradle.kts @@ -35,7 +35,7 @@ plugins { java kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts index 20100bb8f0..8e18d16943 100644 --- a/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/java-kotlin-test/build.gradle.kts @@ -36,7 +36,7 @@ plugins { java kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts index 1a315b05fb..f73bddc7a1 100644 --- a/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/java-library-kotlin-jvm/build.gradle.kts @@ -36,7 +36,7 @@ plugins { `java-library` kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts index 84f0779910..f540ed0af3 100644 --- a/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/kotlin-test/build.gradle.kts @@ -35,7 +35,7 @@ buildscript { plugins { kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts index 0b648083ab..51c0da3211 100644 --- a/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/launch-test/build.gradle.kts @@ -35,7 +35,7 @@ plugins { java kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts b/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts index eec414cf3d..51d556f495 100644 --- a/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts +++ b/gradle-plugin/src/functionalTest/resources/with-functional-test/build.gradle.kts @@ -37,7 +37,7 @@ plugins { java kotlin("jvm") id("com.google.protobuf") - id("@PROTODATA_PLUGIN_ID@") version "@PROTODATA_VERSION@" + id("@COMPILER_PLUGIN_ID@") version "@COMPILER_VERSION@" } repositories { diff --git a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt index 1c2e779826..3ff12d1c5f 100644 --- a/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt +++ b/gradle-plugin/src/test/kotlin/io/spine/compiler/gradle/plugin/ProjectConfigSpec.kt @@ -50,7 +50,6 @@ import org.junit.jupiter.api.io.TempDir @DisplayName("Plugin configuration should") class ProjectConfigSpec { - @Suppress("HasPlatformType") companion object { val mainCompilerTask = CompilerTaskName(SourceSetName.main).value() From 1cd8d9ed6ab3b040a3a4c3e6a071919fccee33ed Mon Sep 17 00:00:00 2001 From: alexander-yevsyukov Date: Tue, 3 Jun 2025 18:17:07 +0100 Subject: [PATCH 11/11] Update build time --- dependencies.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dependencies.md b/dependencies.md index 51672c2b23..c49cd675bf 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1046,7 +1046,7 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -1836,7 +1836,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -2887,7 +2887,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -3962,7 +3962,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -4948,7 +4948,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -5982,7 +5982,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -7033,7 +7033,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8076,7 +8076,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -8884,7 +8884,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -9931,7 +9931,7 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). @@ -11080,4 +11080,4 @@ This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-Lic The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Tue Jun 03 17:27:39 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file +This report was generated on **Tue Jun 03 18:11:05 WEST 2025** using [Gradle-License-Report plugin](https://github.com/jk1/Gradle-License-Report) by Evgeny Naumenko, licensed under [Apache 2.0 License](https://github.com/jk1/Gradle-License-Report/blob/master/LICENSE). \ No newline at end of file