From e23321814cfd3aaf3cba48534aeeaca41a99b3e0 Mon Sep 17 00:00:00 2001 From: Oleg-Melnik Date: Fri, 30 Oct 2026 22:49:02 +0200 Subject: [PATCH 1/3] Migrate code generation to Spine Compiler 2 --- .agents/project.md | 4 +- .agents/skills/README.md | 2 +- .agents/skills/build-engineer/SKILL.md | 2 +- .agents/skills/codegen-engineer/SKILL.md | 10 +- .agents/skills/docs-reviewer/SKILL.md | 2 +- .agents/skills/docs-writer/SKILL.md | 2 +- .agents/skills/engineer/SKILL.md | 2 +- .agents/skills/kotlin-engineer/SKILL.md | 4 +- .agents/skills/model-engineer/SKILL.md | 4 +- README.md | 2 +- codegen/plugins/README.md | 12 +- codegen/plugins/build.gradle.kts | 12 +- codegen/plugins/buildSrc/build.gradle.kts | 53 +----- .../src/main/kotlin/BuildExtensions.kt | 103 +--------- .../src/main/kotlin/DependencyResolution.kt | 72 ++----- .../io/spine/dependency/build/CheckStyle.kt | 34 ---- .../dependency/build/CheckerFramework.kt | 7 +- .../io/spine/dependency/build/ErrorProne.kt | 40 ++-- .../kotlin/io/spine/dependency/build/Ksp.kt | 33 +--- .../kotlin/io/spine/dependency/lib/Auto.kt | 4 +- .../dependency/lib/{Asm.kt => Caffeine.kt} | 15 +- .../kotlin/io/spine/dependency/lib/Flogger.kt | 41 ---- .../kotlin/io/spine/dependency/lib/Grpc.kt | 42 +++-- .../kotlin/io/spine/dependency/lib/Guava.kt | 3 +- .../kotlin/io/spine/dependency/lib/J2ObjC.kt | 2 - .../lib/{JavaPoet.kt => JSpecify.kt} | 13 +- .../kotlin/io/spine/dependency/lib/Jackson.kt | 20 +- .../kotlin/io/spine/dependency/lib/JavaX.kt | 36 ---- .../kotlin/io/spine/dependency/lib/Kotlin.kt | 6 +- .../kotlin/io/spine/dependency/lib/KotlinX.kt | 8 +- .../io/spine/dependency/lib/Protobuf.kt | 11 +- .../kotlin/io/spine/dependency/lib/Slf4J.kt | 26 ++- .../kotlin/io/spine/dependency/local/Base.kt | 32 ++-- .../io/spine/dependency/local/Compiler.kt | 78 ++++++++ .../io/spine/dependency/local/CoreJvm.kt | 32 +--- .../CoreJvmCompiler.kt} | 22 ++- .../io/spine/dependency/local/Logging.kt | 36 ++-- .../io/spine/dependency/local/McJava.kt | 79 -------- .../io/spine/dependency/local/ProtoData.kt | 178 ------------------ .../io/spine/dependency/local/Reflect.kt | 17 +- .../kotlin/io/spine/dependency/local/Time.kt | 49 ++--- .../io/spine/dependency/local/ToolBase.kt | 49 ++--- .../io/spine/dependency/local/Validation.kt | 47 ++--- .../io/spine/dependency/test/Hamcrest.kt | 40 ---- .../kotlin/io/spine/dependency/test/JUnit.kt | 64 ------- .../kotlin/io/spine/dependency/test/Kotest.kt | 58 ------ .../io/spine/dependency/test/OpenTest4J.kt | 38 ---- .../io/spine/dependency/test/TestKitTruth.kt | 41 ---- .../kotlin/io/spine/dependency/test/Truth.kt | 38 ---- .../kotlin/io/spine/gradle/Repositories.kt | 6 +- .../plugins/codegen-plugins/build.gradle.kts | 22 ++- .../com/google/protobuf/GeneratedFile.java | 51 ----- .../plugins/BuilderExtensionGenerator.kt | 6 +- .../plugins/MessageDefFileGenerator.kt | 6 +- .../plugins/MessageDefObjectGenerator.kt | 10 +- .../plugins/MessageFieldObjectGenerator.kt | 38 ++-- .../codegen/plugins/MessageFieldsPlugin.kt | 6 +- .../codegen/plugins/MessageFieldsRenderer.kt | 16 +- .../plugins/MessageOneofObjectGenerator.kt | 12 +- .../chords/codegen/plugins/MessageView.kt | 6 +- .../codegen/plugins/MessageViewRepository.kt | 6 +- .../codegen/plugins/message_type_view.proto | 10 +- .../codegen-workspace/build.gradle.kts | 6 +- .../workspace/build.gradle.kts | 51 ++--- codegen/tests/build.gradle.kts | 36 +++- 65 files changed, 485 insertions(+), 1328 deletions(-) delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckStyle.kt rename codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/{Asm.kt => Caffeine.kt} (81%) delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Flogger.kt rename codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/{JavaPoet.kt => JSpecify.kt} (86%) delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt create mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt rename codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/{lib/CommonsCli.kt => local/CoreJvmCompiler.kt} (72%) delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Hamcrest.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/JUnit.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Kotest.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/OpenTest4J.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/TestKitTruth.kt delete mode 100644 codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Truth.kt delete mode 100644 codegen/plugins/codegen-plugins/src/main/java/com/google/protobuf/GeneratedFile.java diff --git a/.agents/project.md b/.agents/project.md index e003672c..eebe163f 100644 --- a/.agents/project.md +++ b/.agents/project.md @@ -53,7 +53,7 @@ and GitHub Packages. `MessageDef` implementations. - `codegen/tests/` (Gradle path `:codegen-tests`): tests that check the correctness of code generation; uses Chords code generation. -- `codegen/plugins/`: **separate Gradle project** with ProtoData plugins that +- `codegen/plugins/`: **separate Gradle project** with Spine Compiler plugins that generate Kotlin extensions for Protobuf messages. It uses a different toolchain from the root build; see [Build Engineering](skills/build-engineer/SKILL.md). It is applied to consuming projects through the @@ -108,7 +108,7 @@ Gradle dependency chain and its configuration. | `proto-values/README.md` | Supplementary Protobuf messages and extensions | | `client/README.md` | Server connectivity facilities | | `codegen/runtime/README.md` | Codegen runtime ownership | -| `codegen/plugins/README.md` | ProtoData plugin project, requirements, and layout | +| `codegen/plugins/README.md` | Spine Compiler plugin project, requirements, and layout | | `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md` | Contribution policy, distributed by `config/pull` | Keep usage instructions in the nearest library README and API contracts in diff --git a/.agents/skills/README.md b/.agents/skills/README.md index 8f06e7db..fb9d2304 100644 --- a/.agents/skills/README.md +++ b/.agents/skills/README.md @@ -14,7 +14,7 @@ review also uses `kotlin-engineer` with the area skill. `core`, `proto`, and `client`, including the shell, forms, and server-backed UI. - `model-engineer`: change published model Protobuf declarations and Kotlin extensions in `proto-values`; `.proto` edits require `AGENTS.md` authorization. -- `codegen-engineer`: implement ProtoData codegen plugins, the codegen runtime, +- `codegen-engineer`: implement Spine Compiler plugins, the codegen runtime, their generated contracts, internal schemas, and correctness tests. - `build-engineer`: change root and `codegen/plugins` Gradle builds, `buildSrc` dependencies, publishing, versions, and generated reports. diff --git a/.agents/skills/build-engineer/SKILL.md b/.agents/skills/build-engineer/SKILL.md index 1a22a895..ef7b17cb 100644 --- a/.agents/skills/build-engineer/SKILL.md +++ b/.agents/skills/build-engineer/SKILL.md @@ -29,7 +29,7 @@ For `.github/workflows` YAML, use `.agents/skills/ci-engineer/SKILL.md`. - Two toolchains coexist: the root project uses JDK 11 / Gradle 6.9.4 and the compiler/library version split documented in `kotlin-engineer`; - `codegen/plugins` uses JDK 17 / Gradle 9.4.x / Kotlin 2.3.20. Keep build + `codegen/plugins` uses JDK 17 / Gradle 9.4.x / Kotlin 2.4.10. Keep build logic compatible with the owning toolchain. - Dependency coordinates belong in `buildSrc/src/main/kotlin/io/spine/internal/dependency/`, one object per diff --git a/.agents/skills/codegen-engineer/SKILL.md b/.agents/skills/codegen-engineer/SKILL.md index 47745886..0978e26b 100644 --- a/.agents/skills/codegen-engineer/SKILL.md +++ b/.agents/skills/codegen-engineer/SKILL.md @@ -1,7 +1,7 @@ --- name: codegen-engineer description: > - Chords code generation policy. Use for the ProtoData codegen plugins project, + Chords code generation policy. Use for the Spine Compiler plugins project, the codegen runtime library, generated MessageField/MessageOneof/MessageDef contracts, plugin-internal Protobuf declarations, codegen correctness tests, and codegen Gradle wiring. @@ -13,7 +13,7 @@ description: > Use this skill for code generation work: -- ProtoData plugins under `codegen/plugins/` (a separate Gradle project). +- Spine Compiler plugins under `codegen/plugins/` (a separate Gradle project). - Plugin-internal schemas: `codegen/plugins/codegen-plugins/src/main/proto/**`. - The codegen runtime under `codegen/runtime/` (Gradle path `:runtime`): `MessageField`, `MessageOneof`, `MessageDef`, and related runtime types. @@ -29,7 +29,7 @@ that merely consume generated metadata, prefer ## Policy -- `codegen/plugins` targets JDK 17, Gradle 9.4.x, and Kotlin 2.3.20; the root +- `codegen/plugins` targets JDK 17, Gradle 9.4.x, and Kotlin 2.4.10; the root build targets JDK 11 and Gradle 6.9.4, with the Kotlin version split described in `.agents/skills/kotlin-engineer/SKILL.md`. Never mix the two toolchains in one command or assume APIs from one are available in the other. @@ -40,7 +40,7 @@ that merely consume generated metadata, prefer - Treat `.proto` files under `codegen/tests/src/test/proto/**` as generator fixtures. Change them only to express a code-generation scenario; published model declarations under `proto-values` belong to `model-engineer`. -- Keep `codegen/plugins/src/main/resources/codegen-workspace` resources +- Keep `codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace` resources consistent with the build logic that copies `buildSrc` and wrapper files into them; that workspace is what the Chords Gradle plugin unpacks in consumer projects. @@ -51,7 +51,7 @@ that merely consume generated metadata, prefer ## Generation Flow -The separate `codegen/plugins` build produces ProtoData plugins. The root +The separate `codegen/plugins` build produces Spine Compiler plugins. The root `publishCodegenPluginsToMavenLocal` task publishes them to Maven local before the `io.spine.chords` Gradle plugin applies them in a generated workspace. `modulesWithChordsCodegen` selects the consumers (`proto-values` and diff --git a/.agents/skills/docs-reviewer/SKILL.md b/.agents/skills/docs-reviewer/SKILL.md index 9ade2bb2..d4c094f9 100644 --- a/.agents/skills/docs-reviewer/SKILL.md +++ b/.agents/skills/docs-reviewer/SKILL.md @@ -71,7 +71,7 @@ because the task asks for a review. inline links are acceptable when the surrounding file already uses them. - **Terminology is consistent.** Use one term for the same concept within a change set: Chords, Compose Multiplatform, Spine Event Engine, Protobuf, - ProtoData, codegen plugins, codegen runtime, application shell. + Spine Compiler, codegen plugins, codegen runtime, application shell. - **No new orphans.** Added or rewritten paragraphs, list items, and table cells must not end with a one-word line. Do not require unrelated prose to be reflowed solely to repair legacy wrapping. diff --git a/.agents/skills/docs-writer/SKILL.md b/.agents/skills/docs-writer/SKILL.md index b6bee22a..3b8fba2a 100644 --- a/.agents/skills/docs-writer/SKILL.md +++ b/.agents/skills/docs-writer/SKILL.md @@ -91,7 +91,7 @@ claims against the nearest README, build file, workflow, or source file. - Keep examples small enough to verify and copy; follow class-based KDoc, including the `Table` and `EntityChooser` examples. - Use consistent terminology: Chords, Compose Multiplatform, Spine Event - Engine, Protobuf, ProtoData, codegen plugins, codegen runtime, application + Engine, Protobuf, Spine Compiler, codegen plugins, codegen runtime, application shell, class-based components. - Name the precise relationship instead of using vague ownership language. Keep literal API terms and state or resource ownership when that is the contract. diff --git a/.agents/skills/engineer/SKILL.md b/.agents/skills/engineer/SKILL.md index dfea9ab6..8a4e49e3 100644 --- a/.agents/skills/engineer/SKILL.md +++ b/.agents/skills/engineer/SKILL.md @@ -24,7 +24,7 @@ the code being changed: declarations and Kotlin model extensions under `proto-values`, including schema evolution and package and file organization. - `.agents/skills/codegen-engineer/SKILL.md` for the `codegen/plugins` - ProtoData project, the codegen runtime (`codegen/runtime`), codegen + Spine Compiler project, the codegen runtime (`codegen/runtime`), codegen correctness tests (`codegen/tests`), plugin-internal Protobuf declarations, generated `MessageField`/`MessageOneof`/`MessageDef` contracts, and codegen Gradle wiring. diff --git a/.agents/skills/kotlin-engineer/SKILL.md b/.agents/skills/kotlin-engineer/SKILL.md index b5ad62f8..d3075450 100644 --- a/.agents/skills/kotlin-engineer/SKILL.md +++ b/.agents/skills/kotlin-engineer/SKILL.md @@ -29,7 +29,7 @@ Each of these owns its area; this skill stays out of them: KDoc style, and the Compose 1.5.12 ceiling. - `.agents/skills/model-engineer/SKILL.md` — published model Protobuf declarations and Kotlin model extensions under `proto-values`. -- `.agents/skills/codegen-engineer/SKILL.md` — ProtoData plugins and generated +- `.agents/skills/codegen-engineer/SKILL.md` — Spine Compiler plugins and generated runtime contracts. - `.agents/skills/build-engineer/SKILL.md` — Gradle Kotlin DSL, `buildSrc` coordinates, and publishing. @@ -54,7 +54,7 @@ root toolchain covers every module in `settings.gradle.kts`: `core`, `proto`, `proto-values`, `client`, `runtime` (at `codegen/runtime`), and `codegen-tests` (at `codegen/tests`) — note that both `codegen/` subprojects belong to the *root* build. Only -`codegen/plugins` is separate, using **Kotlin 2.3.20** on JDK 17 (its own +`codegen/plugins` is separate, using **Kotlin 2.4.10** on JDK 17 (its own `kotlinVersion` in `codegen/plugins/buildSrc/build.gradle.kts`). Everything below about the Kotlin 1.8 language ceiling applies to the root diff --git a/.agents/skills/model-engineer/SKILL.md b/.agents/skills/model-engineer/SKILL.md index 4ede4b43..c526c2b5 100644 --- a/.agents/skills/model-engineer/SKILL.md +++ b/.agents/skills/model-engineer/SKILL.md @@ -5,7 +5,7 @@ description: > reviewing, or removing project-owned `.proto` declarations and Kotlin model extensions located in `proto-values`, organizing Protobuf packages, imports, and files, or evaluating schema-driven generated-accessor effects. Do not - use for ProtoData plugin, generator, or codegen-runtime implementation; use + use for Spine Compiler plugin, generator, or codegen-runtime implementation; use `codegen-engineer` for those concerns. --- @@ -18,7 +18,7 @@ description: > `proto-values/src/main/kotlin/**`. - Keep schema declarations, Kotlin extensions, and schema-driven generated accessors consistent. -- Use `.agents/skills/codegen-engineer/SKILL.md` for ProtoData plugins, +- Use `.agents/skills/codegen-engineer/SKILL.md` for Spine Compiler plugins, including plugin-internal Protobuf declarations under `codegen/plugins/codegen-plugins/src/main/proto/**`, and for generator behavior, codegen-runtime contracts, and test Protobuf files that exist only diff --git a/README.md b/README.md index 2acf9341..52424676 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ See [codegen/plugins](codegen/plugins/README.md) for more details. Besides the modules for each of the library mentioned above, this repo contains the following key parts: -- [codegen-plugins](codegen/plugins) — separate Gradle project with ProtoData +- [codegen-plugins](codegen/plugins) — separate Gradle project with Spine Compiler plugins that generate Kotlin extensions for Proto messages. See [codegen/plugins/README.md](codegen/plugins/README.md) for detail. diff --git a/codegen/plugins/README.md b/codegen/plugins/README.md index 1f665dcc..586c9653 100644 --- a/codegen/plugins/README.md +++ b/codegen/plugins/README.md @@ -1,6 +1,6 @@ # `codegen-plugins` -A separate Gradle project with ProtoData plugins that generate +A separate Gradle project with Spine Compiler plugins that generate [MessageField](../runtime/src/main/kotlin/io/spine/chords/runtime/MessageField.kt), [MessageOneof](../runtime/src/main/kotlin/io/spine/chords/runtime/MessageOneof.kt), and [MessageDef](../runtime/src/main/kotlin/io/spine/chords/runtime/MessageDef.kt) @@ -8,7 +8,7 @@ implementations for Proto messages. Also, some other useful Kotlin extensions ar e.g. `ValidatingBuilder.messageDef()` that returns the instance of `MessageDef` implementation for the current message builder. -The separate Gradle project is needed because the `ProtoData` plugins, +The separate Gradle project is needed because the `Spine Compiler` plugins, which generate the code, require the newer version of Gradle, `9.4.x` at the moment, and Java 17, comparing to Chords-based projects, which require Gradle version `6.9.x` and Java 11. @@ -16,13 +16,17 @@ and Java 17, comparing to Chords-based projects, which require Gradle version `6 - Java 17 - Gradle `9.4.x` -- Kotlin `2.3.20` +- Kotlin `2.4.10` ### How to use The [Chords Gradle plugin](https://github.com/SpineEventEngine/Chords-Gradle-plugin) should be used to apply `codegen-plugins` to a project. +The workspace exports only Chords `*Def.kt` files. Consumers generate Protobuf Java and +Kotlin DSL files with their configured Protobuf compiler. Export tasks restore missing +definitions even when Spine Compiler is up to date. + ### Resources for the Gradle plugin The following files are copied to the @@ -41,4 +45,4 @@ and the Gradle plugin. ### Modules -* [codegen-plugins](codegen-plugins) — the ProtoData plugins generating the code. +* [codegen-plugins](codegen-plugins) — the Spine Compiler plugins generating the code. diff --git a/codegen/plugins/build.gradle.kts b/codegen/plugins/build.gradle.kts index ac546203..206dcc77 100644 --- a/codegen/plugins/build.gradle.kts +++ b/codegen/plugins/build.gradle.kts @@ -46,7 +46,11 @@ buildscript { doForceVersions(configurations) dependencies { - classpath(io.spine.dependency.local.McJava.pluginLib) + classpath(io.spine.dependency.local.Compiler.pluginLib) + classpath(io.spine.dependency.local.CoreJvmCompiler.gradlePlugin) + classpath(io.spine.dependency.local.Validation.gradlePluginLib) + classpath(io.spine.dependency.local.Time.gradlePlugin) + classpath(io.spine.dependency.build.Ksp.gradlePlugin) } } @@ -55,7 +59,6 @@ plugins { id("net.ltgt.errorprone") id("detekt-code-analysis") id("com.google.protobuf") - id("io.spine.protodata") version "0.96.4" idea } @@ -79,11 +82,12 @@ subprojects { plugin("detekt-code-analysis") plugin("com.google.protobuf") plugin("idea") - plugin("io.spine.mc-java") + plugin("io.spine.core-jvm") } dependencies { - Protobuf.libs.forEach { implementation(it) } + implementation(Protobuf.java) + implementation(Protobuf.kotlin) ErrorProne.apply { errorprone(core) diff --git a/codegen/plugins/buildSrc/build.gradle.kts b/codegen/plugins/buildSrc/build.gradle.kts index 3ecead9b..affab329 100644 --- a/codegen/plugins/buildSrc/build.gradle.kts +++ b/codegen/plugins/buildSrc/build.gradle.kts @@ -37,21 +37,13 @@ repositories { mavenCentral() } -/** - * The version of Jackson used by `buildSrc`. - * - * Please keep this value in sync. with `io.spine.internal.dependency.Jackson.version`. - * It's not a requirement, but would be good in terms of consistency. - */ -val jacksonVersion = "2.17.2" - /** * The version of the Kotlin Gradle plugin. * * Please check that this value matches one defined in * [i o.spine.internal.dependency.Kotlin.version]. */ -val kotlinVersion = "2.3.20" +val kotlinVersion = "2.4.10" /** * The version of Guava used in `buildSrc`. @@ -64,8 +56,6 @@ val guavaVersion = "33.5.0-jre" /** * The version of ErrorProne Gradle plugin. * - * Please keep in sync. with [io.spine.dependency.build.ErrorProne.GradlePlugin.version]. - * * @see * Error Prone Gradle Plugin Releases */ @@ -79,7 +69,7 @@ val errorPronePluginVersion = "4.2.0" * @see * Protobuf Gradle Plugins Releases */ -val protobufPluginVersion = "0.9.6" +val protobufPluginVersion = "0.10.0" /** * The version of Detekt Gradle Plugin. @@ -88,23 +78,10 @@ val protobufPluginVersion = "0.9.6" */ val detektVersion = "2.0.0-alpha.1" -/** - * @see [io.spine.dependency.test.Kotest] - */ -val kotestJvmPluginVersion = "0.4.10" - -/** - * @see [io.spine.dependency.test.Kover] - */ -val koverVersion = "0.9.1" - /** * The version of Google Artifact Registry used by `buildSrc`. * * The version `2.1.5` is the latest before `2.2.0`, which introduces breaking changes. - * - * @see - * Google Artifact Registry at Maven */ val googleAuthToolVersion = "2.1.5" @@ -135,9 +112,6 @@ kotlin { dependencies { dependOnAuthCommon() - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion") - implementation("com.google.guava:guava:$guavaVersion") implementation("net.ltgt.gradle:gradle-errorprone-plugin:${errorPronePluginVersion}") @@ -150,9 +124,6 @@ dependencies { // https://github.com/srikanth-lingala/zip4j implementation("net.lingala.zip4j:zip4j:2.10.0") - - implementation("io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion") - implementation("org.jetbrains.kotlinx:kover-gradle-plugin:$koverVersion") } /** @@ -180,23 +151,3 @@ fun DependencyHandlerScope.dependOnAuthCommon() { exclude(group = "com.google.guava") } } - -dependOnBuildSrcJar() - -/** - * Adds a dependency on a `buildSrc.jar`, iff: - * 1) the `src` folder is missing, and - * 2) `buildSrc.jar` is present in `buildSrc/` folder instead. - * - * This approach is used in the scope of integration testing. - */ -fun Project.dependOnBuildSrcJar() { - val srcFolder = this.rootDir.resolve("src") - val buildSrcJar = rootDir.resolve("buildSrc.jar") - if (!srcFolder.exists() && buildSrcJar.exists()) { - logger.info("Adding the pre-compiled 'buildSrc.jar' to 'implementation' dependencies.") - dependencies { - implementation(files("buildSrc.jar")) - } - } -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/BuildExtensions.kt b/codegen/plugins/buildSrc/src/main/kotlin/BuildExtensions.kt index 5e9990fa..57ae4026 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/BuildExtensions.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/BuildExtensions.kt @@ -24,20 +24,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -@file:Suppress("UnusedReceiverParameter", "unused", "TopLevelPropertyNaming", "ObjectPropertyName") - -import io.spine.dependency.build.ErrorProne -import io.spine.dependency.build.Ksp -import io.spine.dependency.lib.Protobuf -import io.spine.dependency.local.McJava -import io.spine.dependency.local.ProtoData -import io.spine.dependency.test.Kotest import io.spine.gradle.standardToSpineSdk import org.gradle.api.Project import org.gradle.api.Task import org.gradle.kotlin.dsl.ScriptHandlerScope -import org.gradle.plugin.use.PluginDependenciesSpec -import org.gradle.plugin.use.PluginDependencySpec /** * Applies [standard][standardToSpineSdk] repositories to this `buildscript`. @@ -46,92 +36,13 @@ fun ScriptHandlerScope.standardSpineSdkRepositories() { repositories.standardToSpineSdk() } -/** - * Provides shortcuts to reference our dependency objects. - * - * Dependency objects cannot be used under `plugins` section because `io` is a value - * declared in auto-generated `org.gradle.kotlin.dsl.PluginAccessors.kt` file. - * It conflicts with our own declarations. - * - * In such cases, a shortcut to apply a plugin can be created: - * - * ``` - * val PluginDependenciesSpec.`gradle-doctor`: PluginDependencySpec - * get() = id(GradleDoctor.pluginId).version(GradleDoctor.version) - * ``` - * - * But for some plugins, it's impossible to apply them directly to a project. - * For example, when a plugin is not published to Gradle Portal, it can only be - * applied with the buildscript's classpath. Thus, it's needed to leave some freedom - * upon how to apply them. In such cases, just a shortcut to a dependency object - * can be declared without applying the plugin in-place. - */ -private const val ABOUT_DEPENDENCY_EXTENSIONS = "" - -/** - * Shortcut to [McJava] dependency object. - * - * This plugin is not published to Gradle Portal and cannot be applied directly to a project. - * Firstly, it should be put to buildscript's classpath and then applied by ID only. - */ -val PluginDependenciesSpec.mcJava: McJava - get() = McJava - -/** - * Shortcut to [ProtoData] dependency object. - * - * This plugin is published at Gradle Portal. But when used in a pair with [mcJava], - * it cannot be applied directly to a project. - * It is so, because [mcJava] uses [protoData] as its dependency. - * And buildscript's classpath ends up with both of them. - */ -val PluginDependenciesSpec.protoData: ProtoData - get() = ProtoData - -/** - * Provides shortcuts for applying plugins from our dependency objects. - * - * Dependency objects cannot be used under `plugins` section because `io` is a value - * declared in auto-generated `org.gradle.kotlin.dsl.PluginAccessors.kt` file. - * It conflicts with our own declarations. - * - * Declaring of top-level shortcuts eliminates the need in applying plugins - * using fully qualified name of dependency objects. - * - * It is still possible to apply a plugin with a custom version, if needed. - * Just declare a version again on the returned [PluginDependencySpec]. - * - * For example: - * - * ``` - * plugins { - * protobuf version("0.8.19-custom") - * } - * ``` - */ -private const val ABOUT_PLUGIN_ACCESSORS = "" - -val PluginDependenciesSpec.errorprone: PluginDependencySpec - get() = id(ErrorProne.GradlePlugin.id) - -val PluginDependenciesSpec.protobuf: PluginDependencySpec - get() = id(Protobuf.GradlePlugin.id) - -val PluginDependenciesSpec.kotest: PluginDependencySpec - get() = Kotest.MultiplatformGradlePlugin.let { - return id(it.id).version(it.version) - } - -val PluginDependenciesSpec.ksp: PluginDependencySpec - get() = id(Ksp.id).version(Ksp.version) - /** * Configures the dependencies between third-party Gradle tasks - * and those defined via ProtoData and Spine Model Compiler. + * and those defined by the Spine Compiler. * * It is required to avoid warnings in build logs, detecting the undeclared * usage of Spine-specific task output by other tasks, - * e.g., the output of `launchProtoData` is used by `compileKotlin`. + * e.g., the output of `launchSpineCompiler` is used by `compileKotlin`. */ @Suppress("unused") fun Project.configureTaskDependencies() { @@ -155,15 +66,15 @@ fun Project.configureTaskDependencies() { } afterEvaluate { - val launchProtoData = "launchProtoData" - val launchTestProtoData = "launchTestProtoData" + val launchSpineCompiler = "launchSpineCompiler" + val launchTestSpineCompiler = "launchTestSpineCompiler" val generateProto = "generateProto" val createVersionFile = "createVersionFile" - "compileKotlin".dependOn(launchProtoData) - "compileTestKotlin".dependOn(launchTestProtoData) + "compileKotlin".dependOn(launchSpineCompiler) + "compileTestKotlin".dependOn(launchTestSpineCompiler) val sourcesJar = "sourcesJar" sourcesJar.dependOn(generateProto) - sourcesJar.dependOn(launchProtoData) + sourcesJar.dependOn(launchSpineCompiler) sourcesJar.dependOn(createVersionFile) sourcesJar.dependOn("prepareProtocConfigVersions") } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/DependencyResolution.kt b/codegen/plugins/buildSrc/src/main/kotlin/DependencyResolution.kt index 56347312..5f12752c 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/DependencyResolution.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/DependencyResolution.kt @@ -27,17 +27,17 @@ import io.spine.dependency.build.CheckerFramework import io.spine.dependency.build.ErrorProne import io.spine.dependency.build.FindBugs -import io.spine.dependency.lib.Asm import io.spine.dependency.lib.AutoCommon import io.spine.dependency.lib.AutoService import io.spine.dependency.lib.AutoValue -import io.spine.dependency.lib.CommonsCli +import io.spine.dependency.lib.Caffeine import io.spine.dependency.lib.CommonsCodec import io.spine.dependency.lib.CommonsLogging import io.spine.dependency.lib.Grpc import io.spine.dependency.lib.Gson import io.spine.dependency.lib.Guava import io.spine.dependency.lib.J2ObjC +import io.spine.dependency.lib.JSpecify import io.spine.dependency.lib.Jackson import io.spine.dependency.lib.JavaDiffUtils import io.spine.dependency.lib.Kotlin @@ -45,16 +45,10 @@ import io.spine.dependency.lib.KotlinPoet import io.spine.dependency.lib.KotlinX import io.spine.dependency.lib.Protobuf import io.spine.dependency.lib.Slf4J -import io.spine.dependency.test.Hamcrest -import io.spine.dependency.test.JUnit -import io.spine.dependency.test.Kotest -import io.spine.dependency.test.OpenTest4J -import io.spine.dependency.test.Truth import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ConfigurationContainer import org.gradle.api.artifacts.ResolutionStrategy -import org.gradle.kotlin.dsl.exclude import org.gradle.kotlin.dsl.invoke /** @@ -65,7 +59,7 @@ fun doForceVersions(configurations: ConfigurationContainer) { configurations.forceVersions() val validation = io.spine.dependency.local.Validation - val protoData = io.spine.dependency.local.ProtoData + val compiler = io.spine.dependency.local.Compiler val logging = io.spine.dependency.local.Logging val reflect = io.spine.dependency.local.Reflect val base = io.spine.dependency.local.Base @@ -75,24 +69,23 @@ fun doForceVersions(configurations: ConfigurationContainer) { configurations { all { - exclude(group = "io.spine", module = "spine-logging-backend") - resolutionStrategy { + dependencySubstitution { + substitute(module(compiler.bundledCliModule)) + .using(module(compiler.cli)) + .because("Keep bundled Spine classes out of the Compiler runtime.") + } force( reflect.lib, base.lib, base.annotations, - toolBase.lib, - toolBase.intellijPlatform, - toolBase.intellijPlatformJava, + toolBase.libs, coreJvm.server, - protoData.pluginLib, + compiler.libs, logging.lib, - logging.middleware, time.lib, - toolBase.oldLib, + time.javaExtensions, validation.runtime, - validation.oldRuntime, validation.javaBundle ) } @@ -109,7 +102,6 @@ fun NamedDomainObjectContainer.forceVersions() { failOnVersionConflict() cacheChangingModulesFor(0, "seconds") forceProductionDependencies() - forceTestDependencies() forceTransitiveDependencies() } } @@ -137,70 +129,34 @@ private fun ResolutionStrategy.forceProductionDependencies() { KotlinX.Coroutines.jvm, KotlinX.Coroutines.jdk8, KotlinX.Coroutines.bom, - KotlinX.Coroutines.slf4j, Protobuf.GradlePlugin.lib, Protobuf.libs, Slf4J.lib ) } -private fun ResolutionStrategy.forceTestDependencies() { - force( - Guava.testLib, - JUnit.api, - JUnit.bom, - JUnit.Platform.commons, - JUnit.Platform.launcher, - JUnit.legacy, - Truth.libs, - Kotest.assertions, - ) -} - /** * Forces transitive dependencies of 3rd party components that we don't use directly. */ private fun ResolutionStrategy.forceTransitiveDependencies() { force( - Asm.lib, AutoValue.annotations, - CommonsCli.lib, + Caffeine.lib, CommonsCodec.lib, CommonsLogging.lib, Grpc.api, Grpc.bom, Grpc.stub, - Gson.lib, - Hamcrest.core, J2ObjC.annotations, - JUnit.Platform.engine, - JUnit.Platform.suiteApi, - JUnit.runner, + JSpecify.lib, Jackson.annotations, Jackson.bom, Jackson.core, Jackson.databind, - Jackson.dataformatXml, Jackson.dataformatYaml, Jackson.moduleKotlin, + Jackson.otherModules, JavaDiffUtils.lib, Kotlin.jetbrainsAnnotations, - OpenTest4J.lib, ) } - -@Suppress("unused") -fun NamedDomainObjectContainer.excludeProtobufLite() { - - fun excludeProtoLite(configurationName: String) { - named(configurationName).get().exclude( - mapOf( - "group" to "com.google.protobuf", - "module" to "protobuf-lite" - ) - ) - } - - excludeProtoLite("runtimeOnly") - excludeProtoLite("testRuntimeOnly") -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckStyle.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckStyle.kt deleted file mode 100644 index ec2008c9..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckStyle.kt +++ /dev/null @@ -1,34 +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.dependency.build - -// https://checkstyle.sourceforge.io/ -// See `io.spine.internal.gradle.checkstyle.CheckStyleConfig`. -@Suppress("unused", "ConstPropertyName") -object CheckStyle { - const val version = "10.3.4" -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckerFramework.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckerFramework.kt index 4acdba07..76b4382b 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckerFramework.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/CheckerFramework.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -31,9 +31,4 @@ package io.spine.dependency.build object CheckerFramework { private const val version = "3.37.0" const val annotations = "org.checkerframework:checker-qual:${version}" - @Suppress("unused") - val dataflow = listOf( - "org.checkerframework:dataflow:${version}", - "org.checkerframework:javacutil:${version}" - ) } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt index 7a5868b9..243add57 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/ErrorProne.kt @@ -26,34 +26,26 @@ package io.spine.dependency.build -// https://errorprone.info/ -@Suppress("unused", "ConstPropertyName") +/** + * Configures static checks for generated Java sources. + */ +@Suppress("ConstPropertyName") object ErrorProne { - // https://github.com/google/error-prone + /** + * Keeps the compiler and its annotation APIs compatible. + */ private const val version = "2.36.0" - // https://github.com/tbroyer/gradle-errorprone-plugin/blob/v0.8/build.gradle.kts - private const val javacPluginVersion = "9+181-r4173-1" + /** + * Aligns annotations carried by transitive dependencies. + */ val annotations = listOf( - "com.google.errorprone:error_prone_annotations:${version}", - "com.google.errorprone:error_prone_type_annotations:${version}" + "com.google.errorprone:error_prone_annotations:$version", + "com.google.errorprone:error_prone_type_annotations:$version" ) - const val core = "com.google.errorprone:error_prone_core:${version}" - const val checkApi = "com.google.errorprone:error_prone_check_api:${version}" - const val testHelpers = "com.google.errorprone:error_prone_test_helpers:${version}" - const val javacPlugin = "com.google.errorprone:javac:${javacPluginVersion}" - // https://github.com/tbroyer/gradle-errorprone-plugin/releases - object GradlePlugin { - const val id = "net.ltgt.errorprone" - /** - * The version of this plugin is already specified in `buildSrc/build.gradle.kts` file. - * Thus, when applying the plugin in projects build files, only the [id] should be used. - * - * When the plugin is used as a library (e.g. in tools), its version and the library - * artifacts are of importance. - */ - const val version = "3.1.0" - const val lib = "net.ltgt.gradle:gradle-errorprone-plugin:${version}" - } + /** + * Runs Java source checks through the Error Prone Gradle plugin. + */ + const val core = "com.google.errorprone:error_prone_core:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt index 79fa0ae0..f052bad8 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/build/Ksp.kt @@ -27,30 +27,17 @@ package io.spine.dependency.build /** - * Kotlin Symbol Processing API. - * - * @see KSP GitHub repository + * Loads Kotlin symbol processing for the internal model. */ -@Suppress("unused") +@Suppress("ConstPropertyName") object Ksp { - const val version = "2.3.6" - const val dogfoodingVersion = version - const val group = "com.google.devtools.ksp" - - const val id = "com.google.devtools.ksp" - const val gradlePluginArtifactName = "com.google.devtools.ksp.gradle.plugin" - - const val symbolProcessingApi = "$group:symbol-processing-api" - const val symbolProcessing = "$group:symbol-processing" - const val symbolProcessingAaEmb = "$group:symbol-processing-aa-embeddable" - const val symbolProcessingCommonDeps = "$group:symbol-processing-common-deps" - const val gradlePlugin = "$group:symbol-processing-gradle-plugin" + /** + * Aligns the artifacts used by this build. + */ + private const val version = "2.3.12" - val modules = listOf( - symbolProcessingApi, - symbolProcessing, - symbolProcessingAaEmb, - symbolProcessingCommonDeps, - gradlePlugin, - ) + /** + * Provides the Gradle plugin required by the Core JVM compiler. + */ + const val gradlePlugin = "com.google.devtools.ksp:symbol-processing-gradle-plugin:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Auto.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Auto.kt index e1df7efe..48cc8139 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Auto.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Auto.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -38,8 +38,6 @@ object AutoCommon { object AutoService { private const val version = "1.1.1" const val annotations = "com.google.auto.service:auto-service-annotations:${version}" - @Suppress("unused") - const val processor = "com.google.auto.service:auto-service:${version}" } // https://github.com/google/auto diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Caffeine.kt similarity index 81% rename from codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt rename to codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Caffeine.kt index 14c8757c..3ebe5d25 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Asm.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Caffeine.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -26,9 +26,12 @@ package io.spine.dependency.lib -// https://asm.ow2.io/ -@Suppress("unused", "ConstPropertyName") -object Asm { - private const val version = "9.2" - const val lib = "org.ow2.asm:asm:$version" +/** + * Cache runtime required by the Compiler type system. + */ +object Caffeine { + /** + * Aligns transitive requests with the Compiler runtime. + */ + const val lib = "com.github.ben-manes.caffeine:caffeine:3.2.4" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Flogger.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Flogger.kt deleted file mode 100644 index 458f7416..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Flogger.kt +++ /dev/null @@ -1,41 +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.dependency.lib - -// https://github.com/google/flogger -@Suppress("unused", "ConstPropertyName") -object Flogger { - internal const val version = "0.7.4" - const val lib = "com.google.flogger:flogger:${version}" - - object Runtime { - const val systemBackend = "com.google.flogger:flogger-system-backend:${version}" - const val log4j2Backend = "com.google.flogger:flogger-log4j2-backend:${version}" - const val slf4JBackend = "com.google.flogger:flogger-slf4j-backend:${version}" - const val grpcContext = "com.google.flogger:flogger-grpc-context:${version}" - } -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt index 2c5fbaaf..f8bc8ddd 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Grpc.kt @@ -26,26 +26,28 @@ package io.spine.dependency.lib -// https://github.com/grpc/grpc-java -@Suppress("unused", "ConstPropertyName") +/** + * Aligns gRPC APIs used by the Spine event engine. + */ +@Suppress("ConstPropertyName") object Grpc { - @Suppress("MemberVisibilityCanBePrivate") - const val version = "1.76.0" - const val api = "io.grpc:grpc-api:${version}" - const val auth = "io.grpc:grpc-auth:${version}" - const val bom = "io.grpc:grpc-bom:${version}" - const val core = "io.grpc:grpc-core:${version}" - const val context = "io.grpc:grpc-context:${version}" - const val inProcess = "io.grpc:grpc-inprocess:${version}" - const val stub = "io.grpc:grpc-stub:${version}" - const val okHttp = "io.grpc:grpc-okhttp:${version}" - const val protobuf = "io.grpc:grpc-protobuf:${version}" - const val protobufLite = "io.grpc:grpc-protobuf-lite:${version}" - const val netty = "io.grpc:grpc-netty:${version}" - const val nettyShaded = "io.grpc:grpc-netty-shaded:${version}" + /** + * Aligns the artifacts used by this build. + */ + private const val version = "1.76.0" + + /** + * Pins the shared gRPC interfaces. + */ + const val api = "io.grpc:grpc-api:$version" + + /** + * Aligns transitive gRPC modules. + */ + const val bom = "io.grpc:grpc-bom:$version" - object ProtocPlugin { - const val id = "grpc" - const val artifact = "io.grpc:protoc-gen-grpc-java:${version}" - } + /** + * Pins client and server stub support. + */ + const val stub = "io.grpc:grpc-stub:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt index 25201333..25dc7367 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Guava.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -39,5 +39,4 @@ package io.spine.dependency.lib object Guava { private const val version = "33.5.0-jre" const val lib = "com.google.guava:guava:${version}" - const val testLib = "com.google.guava:guava-testlib:${version}" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/J2ObjC.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/J2ObjC.kt index a7dca7c7..b63b4671 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/J2ObjC.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/J2ObjC.kt @@ -37,6 +37,4 @@ object J2ObjC { // https://search.maven.org/artifact/com.google.j2objc/j2objc-annotations private const val version = "1.3" const val annotations = "com.google.j2objc:j2objc-annotations:${version}" - @Deprecated("Please use `annotations` instead.", ReplaceWith("annotations")) - const val lib = annotations } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JSpecify.kt similarity index 86% rename from codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt rename to codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JSpecify.kt index a98fb453..1f68aa3b 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaPoet.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JSpecify.kt @@ -26,9 +26,12 @@ package io.spine.dependency.lib -// https://github.com/square/javapoet -@Suppress("unused", "ConstPropertyName") -object JavaPoet { - private const val version = "1.13.0" - const val lib = "com.squareup:javapoet:${version}" +/** + * Nullability annotations used by Spine 2 APIs. + */ +object JSpecify { + /** + * Aligns transitive requests with the Compiler runtime. + */ + const val lib = "org.jspecify:jspecify:1.0.1" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt index c062c9c1..00026380 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Jackson.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -29,8 +29,8 @@ package io.spine.dependency.lib // https://github.com/FasterXML/jackson/wiki/Jackson-Releases @Suppress("unused", "ConstPropertyName") object Jackson { - const val version = "2.15.2" - private const val databindVersion = "2.15.2" + const val version = "2.22.3" + private const val databindVersion = "2.22.3" private const val coreGroup = "com.fasterxml.jackson.core" private const val dataformatGroup = "com.fasterxml.jackson.dataformat" @@ -41,16 +41,24 @@ object Jackson { // https://github.com/FasterXML/jackson-databind const val databind = "$coreGroup:jackson-databind:${databindVersion}" // https://github.com/FasterXML/jackson-annotations - const val annotations = "$coreGroup:jackson-annotations:${version}" + const val annotations = "$coreGroup:jackson-annotations:2.22" - // https://github.com/FasterXML/jackson-dataformat-xml/releases - const val dataformatXml = "$dataformatGroup:jackson-dataformat-xml:${version}" // https://github.com/FasterXML/jackson-dataformats-text/releases const val dataformatYaml = "$dataformatGroup:jackson-dataformat-yaml:${version}" // https://github.com/FasterXML/jackson-module-kotlin/releases const val moduleKotlin = "$moduleGroup:jackson-module-kotlin:${version}" + /** + * Jackson 2 modules used by the Java formatter and IntelliJ dependencies. + */ + val otherModules = listOf( + "com.fasterxml.jackson.datatype:jackson-datatype-guava:$version", + "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$version", + "$moduleGroup:jackson-module-parameter-names:$version", + "com.fasterxml.jackson.jr:jackson-jr-objects:$version" + ) + // https://github.com/FasterXML/jackson-bom const val bom = "com.fasterxml.jackson:jackson-bom:${version}" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt deleted file mode 100644 index 41b439e5..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/JavaX.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2026, 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.dependency.lib - -@Suppress("unused", "ConstPropertyName") -object JavaX { - // This artifact that used to be a part of J2EE moved under Eclipse EE4J project. - // https://github.com/eclipse-ee4j/common-annotations-api - const val annotations = "javax.annotation:javax.annotation-api:1.3.2" - - const val servletApi = "javax.servlet:javax.servlet-api:3.1.0" -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt index 0c0d2e12..663ce959 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt @@ -35,7 +35,7 @@ object Kotlin { * When changing the version, also change the version used in the `buildSrc/build.gradle.kts`. */ @Suppress("MemberVisibilityCanBePrivate") // used directly from the outside. - const val version = "2.3.20" + const val version = "2.4.10" /** * The version of the JetBrains annotations library, which is a transitive @@ -58,10 +58,6 @@ object Kotlin { const val bom = "${group}:kotlin-bom:${version}" const val reflect = "${group}:kotlin-reflect:${version}" - const val testJUnit5 = "${group}:kotlin-test-junit5:${version}" - - const val gradlePluginApi = "${group}:kotlin-gradle-plugin-api:${version}" - const val gradlePluginLib = "${group}:kotlin-gradle-plugin:${version}" const val jetbrainsAnnotations = "org.jetbrains:annotations:${annotationsVersion}" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt index d35b4c06..bdcca6b3 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/KotlinX.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -34,11 +34,13 @@ object KotlinX { object Coroutines { // https://github.com/Kotlin/kotlinx.coroutines - const val version = "1.7.3" + /** + * Matches the Compiler runtime so coroutine calls link during generation. + */ + const val version = "1.11.0" const val core = "$group:kotlinx-coroutines-core:$version" const val jvm = "$group:kotlinx-coroutines-core-jvm:$version" const val jdk8 = "$group:kotlinx-coroutines-jdk8:$version" const val bom = "$group:kotlinx-coroutines-bom:$version" - const val slf4j = "$group:kotlinx-coroutines-slf4j:$version" } } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt index 14860265..2f01c475 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Protobuf.kt @@ -33,7 +33,7 @@ package io.spine.dependency.lib ) object Protobuf { const val group = "com.google.protobuf" - const val version = "4.31.0" + const val version = "4.36.2" /** * The Java library containing proto definitions of Google Protobuf. @@ -52,13 +52,10 @@ object Protobuf { // https://github.com/google/protobuf-gradle-plugin/releases object GradlePlugin { /** - * The version of this plugin is already specified in `buildSrc/build.gradle.kts` file. - * Thus, when applying the plugin to projects build files, only the [id] should be used. - * - * When changing the version, also change the version used in the `build.gradle.kts`. + * Matches the Protobuf plugin loaded by `buildSrc/build.gradle.kts`. + * Apply `com.google.protobuf` without a version in project build scripts. */ - const val version = "0.9.6" - const val id = "com.google.protobuf" + const val version = "0.10.0" const val lib = "${group}:protobuf-gradle-plugin:${version}" } } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Slf4J.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Slf4J.kt index 713186eb..70df022d 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Slf4J.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/Slf4J.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -27,21 +27,17 @@ package io.spine.dependency.lib /** - * Spine used to log with SLF4J. Now we use Flogger. Whenever a choice comes up, we recommend to - * use the latter. - * - * The primary purpose of having this dependency object is working in combination with - * [Flogger.Runtime.slf4JBackend]. - * - * Some third-party libraries may clash with different versions of the library. - * Thus, we specify this version and force it via [forceVersions]. - * Please see `DependencyResolution.kt` for details. + * Aligns the logging API used by transitive Compiler libraries. */ -@Suppress("unused", "ConstPropertyName") +@Suppress("ConstPropertyName") object Slf4J { + /** + * Aligns the artifacts used by this build. + */ private const val version = "2.0.7" - const val lib = "org.slf4j:slf4j-api:${version}" - const val jdk14 = "org.slf4j:slf4j-jdk14:${version}" - const val reload4j = "org.slf4j:slf4j-reload4j:${version}" - const val simple = "org.slf4j:slf4j-simple:${version}" + + /** + * Pins the shared logging interfaces. + */ + const val lib = "org.slf4j:slf4j-api:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt index 463cbf2b..08b8dcad 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -27,20 +27,22 @@ package io.spine.dependency.local /** - * Spine Base module. - * - * @see spine-base-libraries + * Pins the base APIs shared by Compiler plugins. */ -@Suppress("ConstPropertyName", "unused") +@Suppress("ConstPropertyName") object Base { - const val version = "2.0.0-SNAPSHOT.387" - const val versionForBuildScript = "2.0.0-SNAPSHOT.387" - const val group = Spine.group - private const val prefix = "spine" - const val libModule = "$prefix-base" - const val lib = "$group:$libModule:$version" - const val libForBuildScript = "$group:$libModule:$versionForBuildScript" - const val annotations = "$group:$prefix-annotations:$version" - const val environment = "$group:$prefix-environment:$version" - const val format = "$group:$prefix-format:$version" + /** + * Aligns the artifacts used by this build. + */ + private const val version = "2.0.0-SNAPSHOT.462" + + /** + * Provides message types and Protobuf utilities. + */ + const val lib = "${Spine.group}:spine-base:$version" + + /** + * Keeps annotations compatible with the base APIs. + */ + const val annotations = "${Spine.group}:spine-annotations:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt new file mode 100644 index 00000000..6dc82308 --- /dev/null +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Compiler.kt @@ -0,0 +1,78 @@ +/* + * Copyright 2026, 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.dependency.local + +/** + * Dependencies on the Spine Compiler. + */ +@Suppress("ConstPropertyName") +object Compiler { + /** + * The Compiler release used by the generator and its workspace. + */ + private const val version = "2.0.0-SNAPSHOT.082" + + /** + * Provides the Gradle plugin on the buildscript classpath. + */ + const val pluginLib = "${Spine.toolsGroup}:compiler-gradle-plugin:$version" + + /** + * Provides model events, views, and rendering APIs for Chords plugins. + */ + const val api = "${Spine.toolsGroup}:compiler-api:$version" + + /** + * Resolves Java types and accessors from the Protobuf model. + */ + const val jvm = "${Spine.toolsGroup}:compiler-jvm:$version" + + /** + * Runs the CLI with separately resolved dependencies instead of bundled Spine classes. + */ + const val cli = "${Spine.toolsGroup}:compiler-cli:$version" + + /** + * Identifies the bundled distribution requested by the Compiler Gradle plugin. + */ + const val bundledCliModule = "${Spine.toolsGroup}:compiler-cli-all" + + /** + * Keeps transitive Compiler modules on the release used by the Gradle plugin. + */ + val libs = listOf( + "compiler-api", + "compiler-backend", + "compiler-cli", + "compiler-gradle-api", + "compiler-gradle-plugin", + "compiler-jvm", + "compiler-params", + "compiler-protoc-plugin" + ) + .map { "${Spine.toolsGroup}:$it:$version" } +} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvm.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvm.kt index 8c4393b9..409fc2d8 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvm.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvm.kt @@ -27,29 +27,17 @@ package io.spine.dependency.local /** - * Dependencies on `core-jvm` modules. - * - * See [`SpineEventEngine/core-jvm`](https://github.com/SpineEventEngine/core-jvm/). + * Pins the event engine used to run Compiler plugins. */ -@Suppress("ConstPropertyName", "unused") +@Suppress("ConstPropertyName") object CoreJvm { - const val group = Spine.group - const val version = "2.0.0-SNAPSHOT.400" - - const val coreArtifact = "spine-core" - const val clientArtifact = "spine-client" - const val serverArtifact = "spine-server" - - const val core = "$group:$coreArtifact:$version" - const val client = "$group:$clientArtifact:$version" - const val server = "$group:$serverArtifact:$version" - - const val server_1_9 = "$group:$serverArtifact:1.9.0" - - @Deprecated("Use `serverTestLib` instead.", ReplaceWith("serverTestLib")) - const val testUtilServer = "${Spine.toolsGroup}:spine-server-testlib:$version" + /** + * Aligns the artifacts used by this build. + */ + private const val version = "2.0.0-SNAPSHOT.611" - const val coreTestLib = "${Spine.toolsGroup}:spine-core-testlib:$version" - const val clientTestLib = "${Spine.toolsGroup}:spine-client-testlib:$version" - const val serverTestLib = "${Spine.toolsGroup}:spine-server-testlib:$version" + /** + * Provides the views and event routing used during generation. + */ + const val server = "${Spine.group}:spine-server:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/CommonsCli.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt similarity index 72% rename from codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/CommonsCli.kt rename to codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt index f5210b40..ff5650b2 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/lib/CommonsCli.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJvmCompiler.kt @@ -24,16 +24,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package io.spine.dependency.lib +package io.spine.dependency.local /** - * Commons CLI is a transitive dependency that we don't use directly. - * We `force` it in [forceVersions]. - * - * [Commons CLI](https://commons.apache.org/proper/commons-cli/) + * Generates Spine entity and validation APIs for the plugin model. */ -@Suppress("unused", "ConstPropertyName") -object CommonsCli { - private const val version = "1.5.0" - const val lib = "commons-cli:commons-cli:${version}" +@Suppress("ConstPropertyName") +object CoreJvmCompiler { + /** + * The Core JVM compiler release used for the plugin's internal model. + */ + private const val version = "2.0.0-SNAPSHOT.101" + + /** + * Adds entity, routing, and validation generation to the internal model build. + */ + const val gradlePlugin = "${Spine.toolsGroup}:core-jvm-gradle-plugin:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt index 3bb11408..2da713ce 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Logging.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -27,31 +27,17 @@ package io.spine.dependency.local /** - * Dependencies on the artifacts of the Spine Logging library. - * - * @see spine-logging + * Aligns logging used by the Compiler and its plugins. */ -@Suppress("ConstPropertyName", "unused") +@Suppress("ConstPropertyName") object Logging { - const val version = "2.0.0-SNAPSHOT.411" - const val group = Spine.group - - const val loggingArtifact = "spine-logging" - - const val lib = "$group:$loggingArtifact:$version" - const val libJvm = "$group:spine-logging-jvm:$version" - - const val log4j2Backend = "$group:spine-logging-log4j2-backend:$version" - const val stdContext = "$group:spine-logging-std-context:$version" - const val grpcContext = "$group:spine-logging-grpc-context:$version" - const val smokeTest = "$group:spine-logging-smoke-test:$version" - - const val testLib = "${Spine.toolsGroup}:spine-logging-testlib:$version" + /** + * Aligns the artifacts used by this build. + */ + private const val version = "2.0.0-SNAPSHOT.428" - // Transitive dependencies. - // Make `public` and use them to force a version in a particular repository, if needed. - internal const val julBackend = "$group:spine-logging-jul-backend:$version" - const val middleware = "$group:spine-logging-middleware:$version" - internal const val platformGenerator = "$group:spine-logging-platform-generator:$version" - internal const val jvmDefaultPlatform = "$group:spine-logging-jvm-default-platform:$version" + /** + * Keeps transitive logging requests on one release. + */ + const val lib = "${Spine.group}:spine-logging:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt deleted file mode 100644 index 6ab0a956..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt +++ /dev/null @@ -1,79 +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.dependency.local - -/** - * Dependencies on Spine Model Compiler for Java. - * - * See [mc-java](https://github.com/SpineEventEngine/mc-java). - */ -@Suppress( - "MemberVisibilityCanBePrivate" /* `pluginLib()` is used by subprojects. */, - "ConstPropertyName", - "unused" -) -object McJava { - const val group = Spine.toolsGroup - - /** - * The version used to in the build classpath. - */ - const val dogfoodingVersion = "2.0.0-SNAPSHOT.320" - - /** - * The version to be used for integration tests. - */ - const val version = "2.0.0-SNAPSHOT.320" - - /** - * The ID of the Gradle plugin. - */ - const val pluginId = "io.spine.mc-java" - - /** - * The library with the [dogfoodingVersion]. - */ - val pluginLib = pluginLib(dogfoodingVersion) - - /** - * The library with the given [version]. - */ - fun pluginLib(version: String): String = "$group:spine-mc-java-plugins:$version:all" - - /** The artifact reference for forcing in configurations. */ - const val pluginsArtifact: String = "$group:spine-mc-java-plugins:$version" - - /** - * The `mc-java-base` artifact with the [version]. - */ - val base = base(version) - - /** - * The `mc-java-base` artifact with the given [version]. - */ - fun base(version: String): String = "$group:spine-mc-java-base:$version" -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt deleted file mode 100644 index 1ea81caf..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt +++ /dev/null @@ -1,178 +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.dependency.local - -/** - * Dependencies on ProtoData modules. - * - * To use a locally published ProtoData version instead of the version from a public plugin - * registry, set the `PROTODATA_VERSION` and/or the `PROTODATA_DF_VERSION` environment variables - * and stop the Gradle daemons so that Gradle observes the env change: - * ``` - * export PROTODATA_VERSION=0.43.0-local - * export PROTODATA_DF_VERSION=0.41.0 - * - * ./gradle --stop - * ./gradle build # Conduct the intended checks. - * ``` - * - * Then, to reset the console to run the usual versions again, remove the values of - * the environment variables and stop the daemon: - * ``` - * export PROTODATA_VERSION="" - * export PROTODATA_DF_VERSION="" - * - * ./gradle --stop - * ``` - * - * See [`SpineEventEngine/ProtoData`](https://github.com/SpineEventEngine/ProtoData/). - */ -@Suppress( - "unused" /* Some subprojects do not use ProtoData directly. */, - "ConstPropertyName" /* We use custom convention for artifact properties. */, - "MemberVisibilityCanBePrivate" /* The properties are used directly by other subprojects. */ -) -object ProtoData { - const val pluginGroup = Spine.group - const val group = "io.spine.protodata" - const val pluginId = "io.spine.protodata" - - /** - * Identifies ProtoData as a `classpath` dependency under `buildScript` block. - * - * The dependency is obtained from https://plugins.gradle.org/m2/. - */ - const val module = "io.spine:protodata" - - /** - * The version of ProtoData dependencies. - */ - val version: String - private const val fallbackVersion = "0.96.4" - - /** - * The distinct version of ProtoData used by other build tools. - * - * When ProtoData is used both for building the project and as a part of the Project's - * transitional dependencies, this is the version used to build the project itself. - */ - val dogfoodingVersion: String - private const val fallbackDfVersion = "0.96.4" - - /** - * The artifact for the ProtoData Gradle plugin. - */ - val pluginLib: String - - /** - * The artifact to be used during experiments when publishing locally. - * - * @see ProtoData - */ - private fun pluginLib(version: String): String = - "$group:gradle-plugin:$version" - - fun api(version: String): String = - "$group:protodata-api:$version" - - val api - get() = api(version) - - val backend - get() = "$group:protodata-backend:$version" - - val params - get() = "$group:protodata-params:$version" - - val protocPlugin - get() = "$group:protodata-protoc:$version" - - val gradleApi - get() = "$group:protodata-gradle-api:$version" - - val cliApi - get() = "$group:protodata-cli-api:$version" - - val javaModule = "$group:protodata-java" - - fun java(version: String): String = - "$javaModule:$version" - - val java - get() = java(version) - - val fatCli - get() = "$group:protodata-fat-cli:$version" - - val testlib - get() = "$group:protodata-testlib:$version" - - /** - * An env variable storing a custom [version]. - */ - private const val VERSION_ENV = "PROTODATA_VERSION" - - /** - * An env variable storing a custom [dogfoodingVersion]. - */ - private const val DF_VERSION_ENV = "PROTODATA_DF_VERSION" - - /** - * Sets up the versions and artifacts for the build to use. - * - * If either [VERSION_ENV] or [DF_VERSION_ENV] is set, those versions are used instead of - * the hardcoded ones. Also, in this mode, the [pluginLib] coordinates are changed so that - * it points at a locally published artifact. Otherwise, it points at an artifact that would be - * published to a public plugin registry. - */ - init { - val experimentVersion = System.getenv(VERSION_ENV) - val experimentDfVersion = System.getenv(DF_VERSION_ENV) - if (experimentVersion?.isNotBlank() == true || experimentDfVersion?.isNotBlank() == true) { - version = experimentVersion ?: fallbackVersion - dogfoodingVersion = experimentDfVersion ?: fallbackDfVersion - - pluginLib = pluginLib(version) - println(""" - - ❗ Running an experiment with ProtoData. ❗ - ----------------------------------------- - Regular version = v$version - Dogfooding version = v$dogfoodingVersion - - ProtoData Gradle plugin can now be loaded from Maven Local. - - To reset the versions, erase the `$$VERSION_ENV` and `$$DF_VERSION_ENV` environment variables. - - """.trimIndent()) - } else { - version = fallbackVersion - dogfoodingVersion = fallbackDfVersion - pluginLib = "$pluginGroup:protodata:$version" - } - } -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt index 6980e2e0..147e4ae4 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Reflect.kt @@ -27,14 +27,17 @@ package io.spine.dependency.local /** - * Spine Reflect library. - * - * @see spine-reflect + * Pins reflection utilities used by the Spine event engine. */ @Suppress("ConstPropertyName") object Reflect { - const val version = "2.0.0-SNAPSHOT.200" - const val group = Spine.group - const val artifact = "spine-reflect" - const val lib = "$group:$artifact:$version" + /** + * Aligns the artifacts used by this build. + */ + private const val version = "2.0.0-SNAPSHOT.203" + + /** + * Keeps transitive reflection requests compatible with the event engine. + */ + const val lib = "${Spine.group}:spine-reflect:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt index df36fcab..7bbcc9cf 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Time.kt @@ -27,40 +27,27 @@ package io.spine.dependency.local /** - * Spine Time library. - * - * @see spine-time + * Provides time types and their compiler integration. */ -@Suppress( - "unused" /* Some subprojects do not use all Time artifacts. */, - "ConstPropertyName" /* We use custom convention for artifact properties. */, - "MemberVisibilityCanBePrivate" /* The properties are used directly by other subprojects. */, -) +@Suppress("ConstPropertyName") object Time { - const val group = Spine.group - const val version = "2.0.0-SNAPSHOT.235" - private const val infix = "spine-time" - - fun lib(version: String): String = "$group:$infix:$version" - val lib get() = lib(version) - const val libArtifact: String = infix - - fun javaExtensions(version: String): String = "$group:$infix-java:$version" - val javaExtensions get() = javaExtensions(version) + /** + * Aligns the artifacts used by this build. + */ + private const val version = "2.0.0-SNAPSHOT.253" - fun kotlinExtensions(version: String): String = "$group:$infix-kotlin:$version" - val kotlinExtensions get() = kotlinExtensions(version) + /** + * Configures time validation for the internal model. + */ + const val gradlePlugin = "${Spine.toolsGroup}:time-gradle-plugin:$version" - fun testLib(version: String): String = "${Spine.toolsGroup}:time-testlib:$version" - val testLib get() = testLib(version) + /** + * Aligns time types used by the Compiler and its plugins. + */ + const val lib = "${Spine.group}:spine-time:$version" - val modules: List - get() = listOf( - lib, - javaExtensions, - kotlinExtensions, - testLib - ).map { - it.split(":").let { (g, artifact) -> "$g:$artifact" } - } + /** + * Aligns the Java helpers used by generated validation code. + */ + const val javaExtensions = "${Spine.group}:spine-time-java:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt index 95e07b6e..b2eac4aa 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/ToolBase.kt @@ -31,39 +31,20 @@ package io.spine.dependency.local * * @see tool-base */ -@Suppress("ConstPropertyName", "unused") +@Suppress("ConstPropertyName") object ToolBase { - const val group = Spine.toolsGroup - const val version = "2.0.0-SNAPSHOT.376" - const val dogfoodingVersion = "2.0.0-SNAPSHOT.376" - const val intellijPlatformVersion = "2.0.0-SNAPSHOT.360" - - const val lib = "$group:tool-base:$version" - const val oldLib = "$group:spine-tool-base:2.0.0-SNAPSHOT.332" - const val classicCodegen = "$group:classic-codegen:$version" - const val pluginBase = "$group:plugin-base:$version" - const val pluginTestlib = "$group:plugin-testlib:$version" - - const val intellijPlatform = "$group:intellij-platform:$intellijPlatformVersion" - const val intellijPlatformJava = "$group:intellij-platform-java:$intellijPlatformVersion" - - const val psi = "$group:psi:$version" - const val psiJavaArtifactName = "psi-java" - const val psiJava = "$group:$psiJavaArtifactName:$version" - - const val rootGradlePlugins = "$group:root-gradle-plugins:$version" - const val gradlePluginApi = "$group:gradle-plugin-api:$version" - const val gradlePluginApiTestFixtures = "$group:gradle-plugin-api-test-fixtures:$version" - - const val jvmTools = "$group:jvm-tools:$version" - 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" - - object JavadocFilter { - const val group = ToolBase.group - const val version = "2.0.0-SNAPSHOT.75" - const val artifact = "$group:spine-javadoc-filter:$version" - } + /** + * Aligns the tools shared by the Compiler and its Gradle plugin. + */ + private const val version = "2.0.0-SNAPSHOT.440" + + /** + * Split tool-base artifacts that share APIs across the compiler's classpath. + */ + val libs = listOf( + "code", "kotlin-code", "java-code", "fs", "psi", "psi-java", + "plugin-base", "root-gradle-plugins", "gradle-plugin-api", "jvm-tools", + "protobuf-setup-plugins", "intellij-platform", "intellij-platform-java" + ) + .map { "${Spine.toolsGroup}:$it:$version" } } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt index c495a1f3..de9e054c 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt @@ -27,46 +27,27 @@ package io.spine.dependency.local /** - * Dependencies on Spine Validation SDK. - * - * See [`SpineEventEngine/validation`](https://github.com/SpineEventEngine/validation/). + * Provides validation generation and its runtime. */ -@Suppress("ConstPropertyName", "unused") +@Suppress("ConstPropertyName") object Validation { /** - * The version of the Validation library artifacts. + * Aligns the artifacts used by this build. */ - const val version = "2.0.0-SNAPSHOT.409" + private const val version = "2.0.0-SNAPSHOT.469" /** - * The last version of Validation compatible with ProtoData. + * Configures validation generation for the internal model. */ - const val pdCompatibleVersion = "2.0.0-SNAPSHOT.342" - - const val group = Spine.toolsGroup - private const val prefix = "validation" - - const val gradlePluginLib = "$group:$prefix-gradle-plugin:$version" - - const val runtimeModule = "${Spine.group}:spine-$prefix-jvm-runtime" - - fun runtime(version: String) = "$runtimeModule:$version" - val runtime = runtime(version) - - @Deprecated("Use `runtime` instead.", ReplaceWith("runtime")) - const val oldRuntime = "io.spine.validation:spine-validation-java-runtime:2.0.0-SNAPSHOT.354" - - const val javaModule = "$group:$prefix-java" - const val java = "$javaModule:$version" - const val javaBundleModule = "$group:$prefix-java-bundle" + const val gradlePluginLib = "${Spine.toolsGroup}:validation-gradle-plugin:$version" - /** Obtains the artifact for the `java-bundle` artifact of the given version. */ - fun javaBundle(version: String) = "$javaBundleModule:$version" - - val javaBundle = javaBundle(version) - - const val model = "$group:$prefix-model:$version" + /** + * Runs validation in the internal model and Compiler APIs. + */ + const val runtime = "${Spine.group}:spine-validation-jvm-runtime:$version" - const val configModule = "$group:$prefix-configuration" - const val context = "$group:$prefix-context:$version" + /** + * Provides the validation generator loaded by the Compiler. + */ + const val javaBundle = "${Spine.toolsGroup}:validation-java-bundle:$version" } diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Hamcrest.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Hamcrest.kt deleted file mode 100644 index 774c3fe8..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Hamcrest.kt +++ /dev/null @@ -1,40 +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.dependency.test - -/** - * The dependency on the Hamcrest, which is transitive for us. - * - * If you need assertions in Java, please use Google [Truth] instead. - * For Kotlin, please use [Kotest]. - */ -@Suppress("unused", "ConstPropertyName") -object Hamcrest { - // https://github.com/hamcrest/JavaHamcrest/releases - private const val version = "2.2" - const val core = "org.hamcrest:hamcrest-core:${version}" -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/JUnit.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/JUnit.kt deleted file mode 100644 index 3240262d..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/JUnit.kt +++ /dev/null @@ -1,64 +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.dependency.test - -// https://junit.org/junit5/ -@Suppress("unused", "ConstPropertyName") -object JUnit { - const val version = "5.10.0" - private const val legacyVersion = "4.13.1" - - // https://github.com/apiguardian-team/apiguardian - private const val apiGuardianVersion = "1.1.2" - - // https://github.com/junit-pioneer/junit-pioneer - private const val pioneerVersion = "2.0.1" - - const val legacy = "junit:junit:${legacyVersion}" - - val api = listOf( - "org.apiguardian:apiguardian-api:${apiGuardianVersion}", - "org.junit.jupiter:junit-jupiter-api:${version}", - "org.junit.jupiter:junit-jupiter-params:${version}" - ) - const val bom = "org.junit:junit-bom:${version}" - - const val runner = "org.junit.jupiter:junit-jupiter-engine:${version}" - const val params = "org.junit.jupiter:junit-jupiter-params:${version}" - - const val pioneer = "org.junit-pioneer:junit-pioneer:${pioneerVersion}" - - object Platform { - // https://junit.org/junit5/ - const val version = "1.10.0" - internal const val group = "org.junit.platform" - const val commons = "$group:junit-platform-commons:$version" - const val launcher = "$group:junit-platform-launcher:$version" - const val engine = "$group:junit-platform-engine:$version" - const val suiteApi = "$group:junit-platform-suite-api:$version" - } -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Kotest.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Kotest.kt deleted file mode 100644 index 2ba0a680..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Kotest.kt +++ /dev/null @@ -1,58 +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.dependency.test - -/** - * Testing framework for Kotlin. - * - * @see Kotest site - */ -@Suppress("unused", "ConstPropertyName") -object Kotest { - const val version = "5.6.2" - const val group = "io.kotest" - const val assertions = "$group:kotest-assertions-core:$version" - const val runnerJUnit5 = "$group:kotest-runner-junit5:$version" - const val runnerJUnit5Jvm = "$group:kotest-runner-junit5-jvm:$version" - const val frameworkApi = "$group:kotest-framework-api:$version" - const val datatest = "$group:kotest-framework-datatest:$version" - const val frameworkEngine = "$group:kotest-framework-engine:$version" - - // https://plugins.gradle.org/plugin/io.kotest.multiplatform - object MultiplatformGradlePlugin { - const val version = Kotest.version - const val id = "io.kotest.multiplatform" - const val classpath = "$group:kotest-framework-multiplatform-plugin-gradle:$version" - } - - // https://github.com/kotest/kotest-gradle-plugin - object JvmGradlePlugin { - const val version = "0.4.10" - const val id = "io.kotest" - const val classpath = "$group:kotest-gradle-plugin:$version" - } -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/OpenTest4J.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/OpenTest4J.kt deleted file mode 100644 index fd088378..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/OpenTest4J.kt +++ /dev/null @@ -1,38 +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.dependency.test - -/** - * The dependency on the OpenTest4j library, which is transitive for us. - */ -@Suppress("unused", "ConstPropertyName") -object OpenTest4J { - - // https://github.com/ota4j-team/opentest4j/releases - private const val version = "1.3.0" - const val lib = "org.opentest4j:opentest4j:${version}" -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/TestKitTruth.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/TestKitTruth.kt deleted file mode 100644 index bfec2113..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/TestKitTruth.kt +++ /dev/null @@ -1,41 +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. - */ - -@file:Suppress("MaxLineLength") - -package io.spine.dependency.test - -/** - * Gradle TestKit extension for Google Truth. - * - * @see TestKit source code - * @see Usage description - */ -@Suppress("unused", "ConstPropertyName") -object TestKitTruth { - private const val version = "1.20.0" - const val lib = "com.autonomousapps:testkit-truth:$version" -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Truth.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Truth.kt deleted file mode 100644 index 6e6b6758..00000000 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/dependency/test/Truth.kt +++ /dev/null @@ -1,38 +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.dependency.test - -// https://github.com/google/truth -@Suppress("unused", "ConstPropertyName") -object Truth { - private const val version = "1.1.5" - val libs = listOf( - "com.google.truth:truth:${version}", - "com.google.truth.extensions:truth-java8-extension:${version}", - "com.google.truth.extensions:truth-proto-extension:${version}" - ) -} diff --git a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/gradle/Repositories.kt b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/gradle/Repositories.kt index a0d1edf9..d9c75289 100644 --- a/codegen/plugins/buildSrc/src/main/kotlin/io/spine/gradle/Repositories.kt +++ b/codegen/plugins/buildSrc/src/main/kotlin/io/spine/gradle/Repositories.kt @@ -237,10 +237,10 @@ val RepositoryHandler.jetBrainsCacheRedirector: MavenArtifactRepository */ fun RepositoryHandler.standardToSpineSdk() { val spineRepos = listOf( - Repos.spine, - Repos.spineSnapshots, Repos.artifactRegistry, - Repos.artifactRegistrySnapshots + Repos.artifactRegistrySnapshots, + Repos.spine, + Repos.spineSnapshots ) spineRepos diff --git a/codegen/plugins/codegen-plugins/build.gradle.kts b/codegen/plugins/codegen-plugins/build.gradle.kts index 982c1f11..0fffdcc9 100644 --- a/codegen/plugins/codegen-plugins/build.gradle.kts +++ b/codegen/plugins/codegen-plugins/build.gradle.kts @@ -26,13 +26,13 @@ import io.spine.dependency.lib.KotlinPoet import io.spine.dependency.local.Chords -import io.spine.dependency.local.ProtoData +import io.spine.dependency.local.Compiler dependencies { - // To use ProtoData API in code generation plugin. - implementation(ProtoData.backend) + // To use Spine Compiler API in code generation plugin. + implementation(Compiler.api) // To use `PrimitiveType` extensions. - implementation(ProtoData.java) + implementation(Compiler.jvm) // To generate Kotlin sources. implementation(KotlinPoet.lib) // To use `spine-chords-runtime` published to Maven local. @@ -64,6 +64,7 @@ val copyWorkspaceResources = tasks.register("copyWorkspaceResources") { ) exclude( "buildSrc/.gradle", + "buildSrc/.kotlin", "buildSrc/build", "buildSrc/aus.weis" ) @@ -73,8 +74,11 @@ val copyWorkspaceResources = tasks.register("copyWorkspaceResources") { } } -tasks.named("compileKotlin") { +tasks.matching { it.name == "processResources" || it.name == "sourcesJar" }.configureEach { dependsOn(copyWorkspaceResources) +} + +tasks.named("compileKotlin") { dependsOn("kspKotlin") } @@ -83,11 +87,11 @@ tasks.named("compileTestKotlin") { } tasks.matching { it.name == "kspKotlin" }.configureEach { - dependsOn("launchProtoData") + dependsOn("launchSpineCompiler") } tasks.matching { it.name == "kspTestKotlin" }.configureEach { - dependsOn("launchTestProtoData") + dependsOn("launchTestSpineCompiler") } /** @@ -103,6 +107,10 @@ val cleanWorkspaceResources = tasks.register("cleanWorkspaceResources") { } } +copyWorkspaceResources.configure { + dependsOn(cleanWorkspaceResources) +} + tasks.named("clean") { dependsOn(cleanWorkspaceResources) } diff --git a/codegen/plugins/codegen-plugins/src/main/java/com/google/protobuf/GeneratedFile.java b/codegen/plugins/codegen-plugins/src/main/java/com/google/protobuf/GeneratedFile.java deleted file mode 100644 index 3b8a8f03..00000000 --- a/codegen/plugins/codegen-plugins/src/main/java/com/google/protobuf/GeneratedFile.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2026, 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 com.google.protobuf; - -/** - * Compatibility shim for protobuf-generated classes compiled against an older - * protobuf Java runtime. - * - *

Some transitive Spine artifacts on this module's compile classpath still - * contain generated classes such as {@code io.spine.option.OptionsProto} that - * extend {@code com.google.protobuf.GeneratedFile}. That base class existed in - * older protobuf Java runtimes, but it is no longer present in protobuf 4.x, - * which this module uses. - * - *

As a result, javac fails while resolving those generated Spine classes, - * even though they do not rely on any behavior from {@code GeneratedFile} - * itself. In practice, it is only a marker superclass in this build. - * - *

This shim keeps the compile classpath compatible until the upstream Spine - * artifacts are regenerated against a protobuf runtime that no longer emits - * references to {@code GeneratedFile}. Once those dependencies are updated, - * this class should be removed. - */ -public abstract class GeneratedFile { - protected GeneratedFile() { - } -} diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/BuilderExtensionGenerator.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/BuilderExtensionGenerator.kt index edb6d98e..7900d7ca 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/BuilderExtensionGenerator.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/BuilderExtensionGenerator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -34,8 +34,8 @@ import com.squareup.kotlinpoet.KModifier.PUBLIC import com.squareup.kotlinpoet.PropertySpec import com.squareup.kotlinpoet.asClassName import io.spine.chords.runtime.MessageDef -import io.spine.protodata.ast.TypeName -import io.spine.protodata.type.TypeSystem +import io.spine.tools.compiler.ast.TypeName +import io.spine.tools.compiler.type.TypeSystem /** * Implementation of [FileFragmentGenerator] that generates extension diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefFileGenerator.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefFileGenerator.kt index 4ff6e716..4a55ddf3 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefFileGenerator.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefFileGenerator.kt @@ -35,10 +35,10 @@ import io.spine.chords.runtime.MessageDef import io.spine.chords.runtime.MessageDef.Companion.MESSAGE_DEF_CLASS_SUFFIX import io.spine.chords.runtime.MessageField import io.spine.chords.runtime.MessageOneof -import io.spine.protodata.ast.Field -import io.spine.protodata.ast.TypeName -import io.spine.protodata.type.TypeSystem import io.spine.string.camelCase +import io.spine.tools.compiler.ast.Field +import io.spine.tools.compiler.ast.TypeName +import io.spine.tools.compiler.type.TypeSystem import javax.annotation.Generated /** diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefObjectGenerator.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefObjectGenerator.kt index 627c4445..d16a58cb 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefObjectGenerator.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageDefObjectGenerator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -40,10 +40,10 @@ import io.spine.chords.runtime.MessageDef import io.spine.chords.runtime.MessageField import io.spine.chords.runtime.MessageFieldValue import io.spine.chords.runtime.MessageOneof -import io.spine.protodata.ast.Field -import io.spine.protodata.ast.TypeName -import io.spine.protodata.ast.isPartOfOneof -import io.spine.protodata.type.TypeSystem +import io.spine.tools.compiler.ast.Field +import io.spine.tools.compiler.ast.TypeName +import io.spine.tools.compiler.ast.isPartOfOneof +import io.spine.tools.compiler.type.TypeSystem import java.lang.System.lineSeparator /** diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldObjectGenerator.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldObjectGenerator.kt index 3192be87..d1634cc4 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldObjectGenerator.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldObjectGenerator.kt @@ -40,30 +40,30 @@ import com.squareup.kotlinpoet.TypeSpec import com.squareup.kotlinpoet.asClassName import io.spine.chords.runtime.MessageField import io.spine.protobuf.AnyPacker.unpack -import io.spine.protodata.ast.Field -import io.spine.protodata.ast.FieldType -import io.spine.protodata.ast.FieldType.KindCase.ENUMERATION -import io.spine.protodata.ast.FieldType.KindCase.LIST -import io.spine.protodata.ast.FieldType.KindCase.MAP -import io.spine.protodata.ast.FieldType.KindCase.MESSAGE -import io.spine.protodata.ast.FieldType.KindCase.PRIMITIVE -import io.spine.protodata.ast.Type -import io.spine.protodata.ast.TypeName -import io.spine.protodata.ast.isSingular -import io.spine.protodata.ast.toType -import io.spine.protodata.ast.typeName -import io.spine.protodata.java.getterName -import io.spine.protodata.java.javaPackage -import io.spine.protodata.java.primarySetterName -import io.spine.protodata.java.primitiveClass -import io.spine.protodata.type.TypeSystem -import io.spine.protodata.type.findHeader import io.spine.string.camelCase +import io.spine.tools.compiler.ast.Field +import io.spine.tools.compiler.ast.FieldType +import io.spine.tools.compiler.ast.FieldType.KindCase.ENUMERATION +import io.spine.tools.compiler.ast.FieldType.KindCase.LIST +import io.spine.tools.compiler.ast.FieldType.KindCase.MAP +import io.spine.tools.compiler.ast.FieldType.KindCase.MESSAGE +import io.spine.tools.compiler.ast.FieldType.KindCase.PRIMITIVE +import io.spine.tools.compiler.ast.Type +import io.spine.tools.compiler.ast.TypeName +import io.spine.tools.compiler.ast.isSingular +import io.spine.tools.compiler.ast.toType +import io.spine.tools.compiler.ast.typeName +import io.spine.tools.compiler.jvm.getterName +import io.spine.tools.compiler.jvm.javaPackage +import io.spine.tools.compiler.jvm.primarySetterName +import io.spine.tools.compiler.jvm.primitiveClass +import io.spine.tools.compiler.type.TypeSystem +import io.spine.tools.compiler.type.findHeader /** * Package and class name of the `io.spine.protobuf.ValidatingBuilder`. * - * It is not in the classpath of this ProtoData plugin and cannot be used directly. + * It is not in the classpath of this Spine Compiler plugin and cannot be used directly. */ private object ValidatingBuilder { const val PACKAGE = "io.spine.protobuf" diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsPlugin.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsPlugin.kt index 22c47c7c..9c77b40f 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsPlugin.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsPlugin.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -29,10 +29,10 @@ package io.spine.chords.codegen.plugins import io.spine.chords.runtime.MessageDef import io.spine.chords.runtime.MessageField import io.spine.chords.runtime.MessageOneof -import io.spine.protodata.plugin.Plugin +import io.spine.tools.compiler.plugin.Plugin /** - * The ProtoData [Plugin] that generates [MessageDef], [MessageField], + * The Spine Compiler [Plugin] that generates [MessageDef], [MessageField], * and [MessageOneof] implementations for Proto messages. * * See the [MessageFieldsRenderer] for detail on code generation. diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsRenderer.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsRenderer.kt index 4b2489d6..be25874f 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsRenderer.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageFieldsRenderer.kt @@ -31,24 +31,24 @@ import com.squareup.kotlinpoet.FileSpec import io.spine.chords.runtime.MessageDef import io.spine.chords.runtime.MessageField import io.spine.chords.runtime.MessageOneof -import io.spine.protodata.ast.Field -import io.spine.protodata.ast.TypeName -import io.spine.protodata.java.javaPackage -import io.spine.protodata.render.Renderer -import io.spine.protodata.render.SourceFileSet -import io.spine.protodata.type.TypeSystem import io.spine.string.Indent import io.spine.tools.code.Kotlin +import io.spine.tools.compiler.ast.Field +import io.spine.tools.compiler.ast.TypeName +import io.spine.tools.compiler.jvm.javaPackage +import io.spine.tools.compiler.render.Renderer +import io.spine.tools.compiler.render.SourceFileSet +import io.spine.tools.compiler.type.TypeSystem import java.nio.file.Path /** - * ProtoData [Renderer] that generates [MessageDef], [MessageField], + * Spine Compiler [Renderer] that generates [MessageDef], [MessageField], * and [MessageOneof] implementations for Proto messages. * * The renderer prepares all the required data for code generation * and runs [MessageDefFileGenerator] to generate Kotlin files. */ -public class MessageFieldsRenderer : Renderer(Kotlin.lang()) { +public class MessageFieldsRenderer : Renderer(Kotlin) { private companion object { private const val KOTLIN_SOURCE_ROOT = "kotlin" diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageOneofObjectGenerator.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageOneofObjectGenerator.kt index d0dccbdc..97b51248 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageOneofObjectGenerator.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageOneofObjectGenerator.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -43,11 +43,11 @@ import io.spine.chords.runtime.MessageField import io.spine.chords.runtime.MessageFieldValue import io.spine.chords.runtime.MessageOneof import io.spine.protobuf.AnyPacker.unpack -import io.spine.protodata.ast.Field -import io.spine.protodata.ast.TypeName -import io.spine.protodata.ast.isPartOfOneof -import io.spine.protodata.java.javaCase -import io.spine.protodata.type.TypeSystem +import io.spine.tools.compiler.ast.Field +import io.spine.tools.compiler.ast.TypeName +import io.spine.tools.compiler.ast.isPartOfOneof +import io.spine.tools.compiler.jvm.javaCase +import io.spine.tools.compiler.type.TypeSystem import java.lang.System.lineSeparator /** diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageView.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageView.kt index 8f0513ab..b8f5a02a 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageView.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageView.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -27,8 +27,8 @@ package io.spine.chords.codegen.plugins import io.spine.core.External import io.spine.core.Subscribe -import io.spine.protodata.ast.event.TypeDiscovered -import io.spine.protodata.plugin.View +import io.spine.tools.compiler.ast.event.TypeDiscovered +import io.spine.tools.compiler.plugin.View /** * Records the [MessageTypeView]s. diff --git a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageViewRepository.kt b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageViewRepository.kt index d2a3acd9..506c3757 100644 --- a/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageViewRepository.kt +++ b/codegen/plugins/codegen-plugins/src/main/kotlin/io/spine/chords/codegen/plugins/MessageViewRepository.kt @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -26,10 +26,10 @@ package io.spine.chords.codegen.plugins import io.spine.core.EventContext -import io.spine.protodata.ast.event.TypeDiscovered -import io.spine.protodata.plugin.ViewRepository import io.spine.server.route.EventRoute import io.spine.server.route.EventRouting +import io.spine.tools.compiler.ast.event.TypeDiscovered +import io.spine.tools.compiler.plugin.ViewRepository /** * The repository for [MessageView]. diff --git a/codegen/plugins/codegen-plugins/src/main/proto/spine/chords/codegen/plugins/message_type_view.proto b/codegen/plugins/codegen-plugins/src/main/proto/spine/chords/codegen/plugins/message_type_view.proto index 4795933f..7fc0b4d6 100644 --- a/codegen/plugins/codegen-plugins/src/main/proto/spine/chords/codegen/plugins/message_type_view.proto +++ b/codegen/plugins/codegen-plugins/src/main/proto/spine/chords/codegen/plugins/message_type_view.proto @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -29,14 +29,14 @@ syntax = "proto3"; package spine.chords.codegen.plugins; import "spine/options.proto"; -import "spine/protodata/file.proto"; +import "spine/compiler/file.proto"; option (type_url_prefix) = "type.spine.io"; option java_package = "io.spine.chords.codegen.plugins"; option java_outer_classname = "MessageViewProto"; option java_multiple_files = true; -import "spine/protodata/ast.proto"; +import "spine/compiler/ast.proto"; // View on the message type. message MessageTypeView { @@ -50,8 +50,8 @@ message MessageTypeView { message MessageTypeViewId { // The file where the message is declared. - spine.protodata.File file = 1 [(required) = true]; + spine.compiler.File file = 1 [(required) = true]; // The type of the message. - spine.protodata.TypeName type_name = 2 [(required) = true]; + spine.compiler.TypeName type_name = 2 [(required) = true]; } diff --git a/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/build.gradle.kts b/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/build.gradle.kts index 4b4a10d5..f5bc8433 100644 --- a/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/build.gradle.kts +++ b/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/build.gradle.kts @@ -40,14 +40,13 @@ buildscript { doForceVersions(configurations) dependencies { - classpath(io.spine.dependency.local.McJava.pluginLib) + classpath(io.spine.dependency.local.Compiler.pluginLib) } } plugins { kotlin("jvm") id("com.google.protobuf") - id("io.spine.protodata") version "0.96.4" idea } @@ -89,7 +88,8 @@ subprojects { } dependencies { - Protobuf.libs.forEach { implementation(it) } + // Protobuf definitions are needed as input; this workspace does not compile Kotlin. + implementation(Protobuf.java) } protobuf { diff --git a/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts b/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts index 5daee2e1..c6266ead 100644 --- a/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts +++ b/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts @@ -26,9 +26,9 @@ import io.spine.dependency.local.CoreJvm -// Apply ProtoData directly, without Spine's Model Compiler. +// Apply Spine Compiler directly, without Spine's Model Compiler. plugins { - id("io.spine.protodata") + id("io.spine.compiler") } /** @@ -42,9 +42,9 @@ val codegenPluginsArtifact = project.properties["codegenPluginsArtifact"] as Str val sourceModuleDir = project.properties["sourceModuleDir"] as String dependencies { - // The generated code relies onto `ValidatingBuilder` from Spine `1.9.x`. - implementation(CoreJvm.server_1_9) - protoData(codegenPluginsArtifact) + // Supplies the Spine Protobuf imports used by consumer schemas. + implementation(CoreJvm.server) + spineCompiler(codegenPluginsArtifact) } /** @@ -59,10 +59,11 @@ if (project.hasProperty("dependencyItems")) { } } -protoData { - plugins( - "io.spine.chords.codegen.plugins.MessageFieldsPlugin" - ) +spine { + compiler { + subDirs = listOf("java", "kotlin") + plugins("io.spine.chords.codegen.plugins.MessageFieldsPlugin") + } } /** @@ -71,10 +72,12 @@ protoData { */ tasks.named("compileKotlin") { enabled = false + dependsOn("exportMessageDefinitions") } tasks.named("compileTestKotlin") { enabled = false + dependsOn("exportTestMessageDefinitions") } /** @@ -130,29 +133,27 @@ tasks.named("generateTestProto") { } /** - * Copy generated sources back to the source module. + * Exports Chords message definitions; consumers generate their own Protobuf Kotlin DSL. */ -tasks.named("launchProtoData") { - doLast { - copy { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from("generated/main/kotlin") - into("${sourceModuleDir}/generated/main/kotlin") - } +tasks.register("exportMessageDefinitions") { + dependsOn("launchSpineCompiler") + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from("generated/main/kotlin") { + include("**/*Def.kt") } + into("${sourceModuleDir}/generated/main/kotlin") } /** - * Copy generated test sources back to the source module. + * Exports test message definitions without replacing the consumer's Protobuf Kotlin DSL. */ -tasks.named("launchTestProtoData") { - doLast { - copy { - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from("generated/test/kotlin") - into("${sourceModuleDir}/generated/test/kotlin") - } +tasks.register("exportTestMessageDefinitions") { + dependsOn("launchTestSpineCompiler") + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from("generated/test/kotlin") { + include("**/*Def.kt") } + into("${sourceModuleDir}/generated/test/kotlin") } /** diff --git a/codegen/tests/build.gradle.kts b/codegen/tests/build.gradle.kts index 05efb035..2199cfc2 100644 --- a/codegen/tests/build.gradle.kts +++ b/codegen/tests/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright 2025, TeamDev. All rights reserved. + * Copyright 2026, 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. @@ -28,6 +28,7 @@ import com.google.protobuf.gradle.generateProtoTasks import com.google.protobuf.gradle.id import com.google.protobuf.gradle.protobuf import com.google.protobuf.gradle.protoc +import io.spine.chords.gradle.ApplyCodegenPlugins import io.spine.internal.dependency.Kotest import io.spine.internal.dependency.Protobuf import io.spine.internal.dependency.Spine @@ -65,3 +66,36 @@ dependencies { implementation(project(":runtime")) testImplementation(Kotest.runnerJUnit5) } + +/** + * Protobuf dependencies declared here apply to generation and its export verification. + */ +val codegenProtoDependencies = emptySet() + +chordsGradlePlugin { + protoDependencies(*codegenProtoDependencies.toTypedArray()) +} + +/** + * Verifies that an up-to-date compiler result restores deleted consumer definitions. + */ +val verifyCodegenExport by tasks.registering(ApplyCodegenPlugins::class) { + val generation = tasks.named("applyCodegenPlugins").get() + dependsOn(generation) + workspaceDir = generation.workspaceDir + sourceModuleDir = generation.sourceModuleDir + codegenPluginsArtifact = generation.codegenPluginsArtifact + includeGradleProperties = generation.includeGradleProperties.toMutableSet() + dependencies(codegenProtoDependencies) + // Root `clean` also reaches nested builds; preserve the compiler output for this check. + task("build", "--exclude-task=clean") + doFirst { + delete(fileTree("generated") { + include("**/*Def.kt") + }) + } +} + +tasks.matching { it.name == "compileKotlin" || it.name == "compileTestKotlin" }.configureEach { + dependsOn(verifyCodegenExport) +} From 68e2c6824ed6a58ff7fc586bb8c0f2a115678380 Mon Sep 17 00:00:00 2001 From: Oleg-Melnik Date: Fri, 30 Oct 2026 22:49:03 +0200 Subject: [PATCH 2/3] =?UTF-8?q?Bump=20version=20=E2=80=94>=20`2.0.0-SNAPSH?= =?UTF-8?q?OT.150`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dependencies.md | 24 ++++++++++++------------ pom.xml | 4 ++-- version.gradle.kts | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dependencies.md b/dependencies.md index 0d008643..d64b3eab 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1,6 +1,6 @@ -# Dependencies of `io.spine.chords:spine-chords-client:2.0.0-SNAPSHOT.148` +# Dependencies of `io.spine.chords:spine-chords-client:2.0.0-SNAPSHOT.150` ## Runtime 1. **Group** : cafe.adriel.voyager. **Name** : voyager-core. **Version** : 1.0.1.**No license information found** @@ -1129,12 +1129,12 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 13:57:52 EET 2026** 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 Oct 30 22:47:57 EET 2026** 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.chords:spine-chords-codegen-tests:2.0.0-SNAPSHOT.148` +# Dependencies of `io.spine.chords:spine-chords-codegen-tests:2.0.0-SNAPSHOT.150` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -1924,12 +1924,12 @@ This report was generated on **Fri Oct 30 13:57:52 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 13:57:52 EET 2026** 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 Oct 30 22:47:58 EET 2026** 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.chords:spine-chords-core:2.0.0-SNAPSHOT.148` +# Dependencies of `io.spine.chords:spine-chords-core:2.0.0-SNAPSHOT.150` ## Runtime 1. **Group** : cafe.adriel.voyager. **Name** : voyager-core. **Version** : 1.0.1. @@ -2963,12 +2963,12 @@ This report was generated on **Fri Oct 30 13:57:52 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 13:57:53 EET 2026** 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 Oct 30 22:47:59 EET 2026** 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.chords:spine-chords-proto:2.0.0-SNAPSHOT.148` +# Dependencies of `io.spine.chords:spine-chords-proto:2.0.0-SNAPSHOT.150` ## Runtime 1. **Group** : cafe.adriel.voyager. **Name** : voyager-core. **Version** : 1.0.1.**No license information found** @@ -4001,12 +4001,12 @@ This report was generated on **Fri Oct 30 13:57:53 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 13:57:54 EET 2026** 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 Oct 30 22:48:00 EET 2026** 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.chords:spine-chords-proto-values:2.0.0-SNAPSHOT.148` +# Dependencies of `io.spine.chords:spine-chords-proto-values:2.0.0-SNAPSHOT.150` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -4800,12 +4800,12 @@ This report was generated on **Fri Oct 30 13:57:54 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 13:57:56 EET 2026** 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 Oct 30 22:48:01 EET 2026** 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.chords:spine-chords-runtime:2.0.0-SNAPSHOT.148` +# Dependencies of `io.spine.chords:spine-chords-runtime:2.0.0-SNAPSHOT.150` ## Runtime 1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2. @@ -5569,4 +5569,4 @@ This report was generated on **Fri Oct 30 13:57:56 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 13:57:56 EET 2026** 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 Oct 30 22:48:02 EET 2026** 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 3fe6c914..1d20a25c 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject. --> io.spine.chords Chords -2.0.0-SNAPSHOT.148 +2.0.0-SNAPSHOT.150 2015 @@ -242,7 +242,7 @@ all modules and does not describe the project structure per-subproject. io.spine.chords spine-chords-codegen-plugins - 2.0.0-SNAPSHOT.148 + 2.0.0-SNAPSHOT.150 io.spine.tools diff --git a/version.gradle.kts b/version.gradle.kts index 360522a4..f89f5aef 100644 --- a/version.gradle.kts +++ b/version.gradle.kts @@ -27,4 +27,4 @@ /** * The version of all Chords libraries. */ -val chordsVersion: String by extra("2.0.0-SNAPSHOT.148") +val chordsVersion: String by extra("2.0.0-SNAPSHOT.150") From 1c9eb65d77bd5600934b49ea9690a94812a600e2 Mon Sep 17 00:00:00 2001 From: Oleg-Melnik Date: Fri, 30 Oct 2026 23:14:27 +0200 Subject: [PATCH 3/3] Export definitions only after code generation --- codegen/plugins/README.md | 3 +- .../workspace/build.gradle.kts | 32 +++++++++-------- codegen/tests/build.gradle.kts | 34 ------------------- dependencies.md | 12 +++---- 4 files changed, 25 insertions(+), 56 deletions(-) diff --git a/codegen/plugins/README.md b/codegen/plugins/README.md index 586c9653..36fc52a3 100644 --- a/codegen/plugins/README.md +++ b/codegen/plugins/README.md @@ -24,8 +24,7 @@ The [Chords Gradle plugin](https://github.com/SpineEventEngine/Chords-Gradle-plu should be used to apply `codegen-plugins` to a project. The workspace exports only Chords `*Def.kt` files. Consumers generate Protobuf Java and -Kotlin DSL files with their configured Protobuf compiler. Export tasks restore missing -definitions even when Spine Compiler is up to date. +Kotlin DSL files with their configured Protobuf compiler. ### Resources for the Gradle plugin diff --git a/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts b/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts index c6266ead..b519a7c3 100644 --- a/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts +++ b/codegen/plugins/codegen-plugins/src/main/resources/codegen-workspace/workspace/build.gradle.kts @@ -72,12 +72,10 @@ spine { */ tasks.named("compileKotlin") { enabled = false - dependsOn("exportMessageDefinitions") } tasks.named("compileTestKotlin") { enabled = false - dependsOn("exportTestMessageDefinitions") } /** @@ -135,25 +133,31 @@ tasks.named("generateTestProto") { /** * Exports Chords message definitions; consumers generate their own Protobuf Kotlin DSL. */ -tasks.register("exportMessageDefinitions") { - dependsOn("launchSpineCompiler") - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from("generated/main/kotlin") { - include("**/*Def.kt") +tasks.named("launchSpineCompiler") { + doLast { + copy { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from("generated/main/kotlin") { + include("**/*Def.kt") + } + into("${sourceModuleDir}/generated/main/kotlin") + } } - into("${sourceModuleDir}/generated/main/kotlin") } /** * Exports test message definitions without replacing the consumer's Protobuf Kotlin DSL. */ -tasks.register("exportTestMessageDefinitions") { - dependsOn("launchTestSpineCompiler") - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - from("generated/test/kotlin") { - include("**/*Def.kt") +tasks.named("launchTestSpineCompiler") { + doLast { + copy { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from("generated/test/kotlin") { + include("**/*Def.kt") + } + into("${sourceModuleDir}/generated/test/kotlin") + } } - into("${sourceModuleDir}/generated/test/kotlin") } /** diff --git a/codegen/tests/build.gradle.kts b/codegen/tests/build.gradle.kts index 2199cfc2..d3f24dd9 100644 --- a/codegen/tests/build.gradle.kts +++ b/codegen/tests/build.gradle.kts @@ -28,7 +28,6 @@ import com.google.protobuf.gradle.generateProtoTasks import com.google.protobuf.gradle.id import com.google.protobuf.gradle.protobuf import com.google.protobuf.gradle.protoc -import io.spine.chords.gradle.ApplyCodegenPlugins import io.spine.internal.dependency.Kotest import io.spine.internal.dependency.Protobuf import io.spine.internal.dependency.Spine @@ -66,36 +65,3 @@ dependencies { implementation(project(":runtime")) testImplementation(Kotest.runnerJUnit5) } - -/** - * Protobuf dependencies declared here apply to generation and its export verification. - */ -val codegenProtoDependencies = emptySet() - -chordsGradlePlugin { - protoDependencies(*codegenProtoDependencies.toTypedArray()) -} - -/** - * Verifies that an up-to-date compiler result restores deleted consumer definitions. - */ -val verifyCodegenExport by tasks.registering(ApplyCodegenPlugins::class) { - val generation = tasks.named("applyCodegenPlugins").get() - dependsOn(generation) - workspaceDir = generation.workspaceDir - sourceModuleDir = generation.sourceModuleDir - codegenPluginsArtifact = generation.codegenPluginsArtifact - includeGradleProperties = generation.includeGradleProperties.toMutableSet() - dependencies(codegenProtoDependencies) - // Root `clean` also reaches nested builds; preserve the compiler output for this check. - task("build", "--exclude-task=clean") - doFirst { - delete(fileTree("generated") { - include("**/*Def.kt") - }) - } -} - -tasks.matching { it.name == "compileKotlin" || it.name == "compileTestKotlin" }.configureEach { - dependsOn(verifyCodegenExport) -} diff --git a/dependencies.md b/dependencies.md index d64b3eab..6da018cb 100644 --- a/dependencies.md +++ b/dependencies.md @@ -1129,7 +1129,7 @@ The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 22:47:57 EET 2026** 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 Oct 30 23:07:29 EET 2026** 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). @@ -1924,7 +1924,7 @@ This report was generated on **Fri Oct 30 22:47:57 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 22:47:58 EET 2026** 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 Oct 30 23:07:30 EET 2026** 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). @@ -2963,7 +2963,7 @@ This report was generated on **Fri Oct 30 22:47:58 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 22:47:59 EET 2026** 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 Oct 30 23:07:31 EET 2026** 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). @@ -4001,7 +4001,7 @@ This report was generated on **Fri Oct 30 22:47:59 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 22:48:00 EET 2026** 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 Oct 30 23:07:32 EET 2026** 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). @@ -4800,7 +4800,7 @@ This report was generated on **Fri Oct 30 22:48:00 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 22:48:01 EET 2026** 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 Oct 30 23:07:33 EET 2026** 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). @@ -5569,4 +5569,4 @@ This report was generated on **Fri Oct 30 22:48:01 EET 2026** using [Gradle-Lice The dependencies distributed under several licenses, are used according their commercial-use-friendly license. -This report was generated on **Fri Oct 30 22:48:02 EET 2026** 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 Oct 30 23:07:33 EET 2026** 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