Arrange LaunchSpineCompiler state at configuration time#81
Merged
Conversation
Gradle 9.6 deprecates mutating task state at execution time, and the deprecations become hard errors in Gradle 10/11. The launch task used to assemble its CLI command, including the `mainClass` property, in a `doFirst` action, and to query `Task.dependsOn` while writing the parameters file. Consumer builds saw two warnings in problem reports: - "Changing property value of task ':launchSpineCompiler' property 'mainClass' at execution time" (an error starting with Gradle 11); - "Invocation of Task.dependsOn at execution time" (an error starting with Gradle 10, incompatible with the configuration cache). Now the `init` block sets the constant `mainClass`, `applyDefaults()` adds the classpath and registers the `--params <file>` pair via `argumentProviders` — keeping the absolute path out of the build-cache key, as before — and the new `protoSourceDirs` property, wired by `consumeProtoFrom()` from `handleLaunchTaskDependency()`, replaces the `dependsOn` traversal. Writing the parameters file deliberately stays a `doFirst` action: serializing `PipelineParameters` loads Spine `KnownTypes` via the thread context classloader, which Gradle sets to the plugin classloader only around `doFirst`/`doLast` actions. A file-system side effect is not a task-state mutation, so no deprecation is triggered. A new functional test runs a consumer fixture with `--warning-mode=all` and locks the absence of both warnings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Also commit the regenerated dependency reports. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Reuse `createLaunchTestProject()` in the deprecation regression test instead of duplicating the fixture name. - Clarify KDoc wording flagged by the documentation review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Spine Compiler Gradle plugin to avoid Gradle 9.6+ “execution-time mutation” deprecations by moving LaunchSpineCompiler task state setup fully into configuration time, keeping the task compatible with configuration cache and upcoming Gradle 10/11 behavior.
Changes:
- Configure
LaunchSpineCompiler’s constantmainClass, classpath, and CLI--params <file>argument at configuration time (usingargumentProviders) and remove the execution-time command-line assembly. - Replace execution-time
dependsOntraversal with an explicitprotoSourceDirscarrier populated viaconsumeProtoFrom(generateProto), and fail fast on reserved task-name collisions. - Add a functional regression test asserting the deprecation warnings are absent under
--warning-mode=all, plus version/report bumps.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| version.gradle.kts | Bumps the compiler version snapshot used by builds/tests. |
| gradle-plugin/src/main/kotlin/io/spine/tools/compiler/gradle/plugin/Plugin.kt | Wires GenerateProtoTask → LaunchSpineCompiler relationship via consumeProtoFrom() and adds a guarded fast-fail for task-name collisions. |
| gradle-plugin/src/main/kotlin/io/spine/tools/compiler/gradle/plugin/LaunchSpineCompiler.kt | Moves task state setup to configuration time; introduces protoSourceDirs and argumentProviders; removes execution-time command-line mutation. |
| gradle-plugin/src/functionalTest/kotlin/io/spine/tools/compiler/gradle/plugin/PluginSpec.kt | Adds a functional test ensuring Gradle deprecation warnings are not emitted. |
| docs/dependencies/pom.xml | Updates docs dependency metadata version to the new snapshot. |
| docs/dependencies/dependencies.md | Regenerates dependency report for the new snapshot/version. |
| .agents/tasks/fix-launch-task-exec-time-config.md | Adds an agent task log/plan document (non-functional project metadata). |
CI failed on `Build on Ubuntu` and the performance smoke test with `io.spine.type.UnknownTypeException` after restoring `known_types` descriptor sets `FROM-CACHE`. This is the descriptor-set build-cache bug documented in PR #80: the descriptor file name embeds the Maven version, but the name was not part of the task cache key, so the version bump in this branch made CI restore the stale entry cached by the `.061` build. The fix shipped with ToolBase 2.0.0-SNAPSHOT.403 reaches a consumer build only through the Compiler pin on its buildscript classpath, and this repository is such a consumer via dogfooding: the bootstrap pin `2.0.0-SNAPSHOT.059` predates the fix. Advance `fallbackVersion` and `fallbackDfVersion` to `2.0.0-SNAPSHOT.061`, built from `master` with ToolBase `.403`. The new plugin classpath also changes the classloader hash of the proto-generating tasks, so CI takes cache misses instead of the poisoned entries. Also commit the dependency reports regenerated with the new pin. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #81 +/- ##
============================================
+ Coverage 76.60% 76.87% +0.27%
- Complexity 687 688 +1
============================================
Files 205 205
Lines 4018 4026 +8
Branches 400 402 +2
============================================
+ Hits 3078 3095 +17
+ Misses 810 801 -9
Partials 130 130 🚀 New features to boost your workflow:
|
armiol
approved these changes
Jul 11, 2026
armiol
left a comment
Contributor
There was a problem hiding this comment.
@alexander-yevsyukov fingers crossed, LGTM.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Eliminates two Gradle deprecation warnings that consumer builds (observed in
delivery-serveron Gradle 9.6.1) receive from every executedlaunchSpineCompilertask:How
All task state is now arranged at configuration time:
mainClassis set in the taskinitblock.Configurations) is added inapplyDefaults().--params <file>pair is registered viaargumentProviders, so it is evaluated only when the command line is built and — as before — the absolute path stays out of the build-cache key, keeping cached outputs relocatable.protoSourceDirs: ConfigurableFileCollectionproperty, wired byconsumeProtoFrom()fromhandleLaunchTaskDependency(), replaces the execution-timedependsOn.first { it is GenerateProtoTask }traversal.compileCommandLine()is deleted; a name-collision on the reserved task name now fails fast with a curatedcheckmessage instead of a silent misconfiguration.Deliberately unchanged: writing the parameters file stays a
doFirstaction. SerializingPipelineParametersloads SpineKnownTypesthrough the thread context classloader, which Gradle sets to the plugin classloader only arounddoFirst/doLastactions — from the@TaskActionmethod thedesc.reflookup fails. The constraint is documented at the call site. A file write is a side effect, not task-state mutation, so it triggers no deprecation.Verification
./gradlew build dokkaGenerateis green.PluginSpec."not mutate the launch task state at execution time") runs a consumer fixture with--warning-mode=alland asserts both messages are absent.2.0.0-SNAPSHOT.060(pre-fix) emits both warnings exactly once each; this branch's plugin emits none, with the launch task executing in both runs.2.0.0-SNAPSHOT.061 → .062with regenerated dependency reports),spine-code-review,kotlin-engineer, andreview-docsreviewers (all feedback applied).🤖 Generated with Claude Code