Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 107 additions & 0 deletions .agents/tasks/fix-launch-task-exec-time-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
slug: fix-launch-task-exec-time-config
branch: master # working tree only; the user decides branch/commit
owner: claude
status: in-review
started: 2026-07-10
---

## Goal

`LaunchSpineCompiler` no longer mutates task state at execution time, so
consumer builds (e.g. `delivery-server`) stop seeing the Gradle 9.6 deprecations
that become errors in Gradle 10/11:

1. *"Changing property value of task '…:launchSpineCompiler' property 'mainClass'
at execution time"* (error in Gradle 11).
2. *"Invocation of Task.dependsOn at execution time"* (error in Gradle 10,
configuration-cache incompatible).

## Context

Both warnings originate from the `doFirst { compileCommandLine();
createParametersFile() }` block installed by `applyDefaults()` in
`gradle-plugin/src/main/kotlin/io/spine/tools/compiler/gradle/plugin/LaunchSpineCompiler.kt`:

- `compileCommandLine()` sets `mainClass`, `classpath`, and `args` inside a task
action. `mainClass` is a tracked `Property` — Gradle nags on it now; the rest
will follow.
- `createParametersFile()` traverses `dependsOn` at execution time to locate
the `GenerateProtoTask`.

None of the deferred values actually require execution-time assembly:
`mainClass` is the constant `CLI_APP_CLASS`; the classpath consists of two lazy
`Configuration`s; the only argument pair is `--params <file>` whose path is
fully known once the source-set name is fixed in `applyDefaults()`.

Observed in `delivery-server` `build/reports/problems/problems-report.html`
(build `:admin-server:build`, Gradle 9.6.1), task `:grpc-api:launchSpineCompiler`.

## Plan

- [x] `LaunchSpineCompiler.kt`
- [x] Set `mainClass.set(CLI_APP_CLASS)` in the `init` block (constant).
- [x] Add `classpath(...)` for the two configurations in `applyDefaults()`
(configuration time; resolution stays lazy).
- [x] Register the `--params <file>` pair via `argumentProviders` in
`applyDefaults()` — evaluated when the command line is built, without
mutating `args`, and (as today) without entering the build-cache key,
keeping cached outputs relocatable.
- [x] Add `@get:Internal internal abstract val protoSourceDirs:
ConfigurableFileCollection` — explicit carrier for the proto source
dirs, replacing the `dependsOn` traversal. `Internal` because the proto
content is already fingerprinted via `requestFile`.
- [x] Add `consumeProtoFrom(GenerateProtoTask)` helper: `dependsOn(task)` +
`protoSourceDirs.from(task.sourceDirs)`.
- [x] `createParametersFile()`: read `protoSourceDirs` instead of
`dependsOn.first { it is GenerateProtoTask }`.
- [x] ~~Call `createParametersFile()` from the `exec()` override~~ — reverted;
the write stays a `doFirst` action (see Log for the classloader
constraint). `compileCommandLine()` deleted as planned.
- [x] `Plugin.kt`
- [x] `handleLaunchTaskDependency()`: use `consumeProtoFrom(...)` in both
branches (existing task / `afterEvaluate` creation).
- [x] Verify: full `./gradlew build` green (all module tests + functional
tests); regression test `PluginSpec."not mutate the launch task state
at execution time"` added (runs `launch-test` with `--warning-mode=all`
and asserts the two messages are absent); version bumped to
`2.0.0-SNAPSHOT.062`; dependency reports regenerated; A/B-proven with
a standalone consumer on Gradle 9.6.1: plugin `.060` emits both
warnings, `.062` emits none, launch task executed in both runs.

## Log

- 2026-07-10 — analysed delivery-server problems report; drafted plan; executing.
- 2026-07-10 — both files edited; note: the `--info` command-line log from
`compileCommandLine()` is gone; `createParametersFile()` still logs the
parameters file path. Build + `spine-code-review`/`kotlin-engineer`
reviews running.
- 2026-07-10 — functional tests failed (14/17): moving `createParametersFile()`
into the `exec()` override broke Spine `KnownTypes` loading —
`PipelineParameters.toJson()` resolves `desc.ref` resources via the thread
context classloader, which Gradle sets to the plugin classloader only
around `doFirst`/`doLast` actions, not around the `@TaskAction` method.
Fix: the parameters-file write stays a `doFirst` action (a file-system
side effect is not a task-state mutation, so no deprecation); constraint
recorded in a code comment at the call site. Re-running tests.
- 2026-07-10 — all green. Reviews: `kotlin-engineer` APPROVE,
`spine-code-review` APPROVE WITH CHANGES — applied: `check` with curated
message instead of raw cast in `handleLaunchTaskDependency`, KDoc precision,
version bump, deprecation regression test in `PluginSpec`. A/B verification
via a scratchpad consumer project (mavenLocal plugin `.060` vs `.062`,
`--warning-mode=all`): warnings present before, absent after.
Working tree ready for review; not committed (no commit authorization).
- 2026-07-10 — PR #81 opened (3 commits; pre-pr gate PASS).
- 2026-07-10 — CI failed on `Build on Ubuntu`, `Engine performance smoke test`,
and `JUnit Test Report` with `io.spine.type.UnknownTypeException` +
placeholder-descriptor warnings. Root cause: NOT this branch's code —
the exact descriptor-set build-cache bug documented in PR #80. This PR's
version bump `.061->.062` made CI restore the stale `known_types` descriptor
cached by PR #80's own `.061` build (`:test-env:generateProto FROM-CACHE`);
the repo's bootstrap ("dogfooding") Compiler pin `.059` still carries the
unfixed ToolBase `.402`, and the fix "reaches consumers only by advancing
the Compiler's pin" (PR #80). Tests pass locally where the poisoned shared
cache is not in play. Fix: bump `Compiler.fallbackVersion` and
`fallbackDfVersion` to `2.0.0-SNAPSHOT.061` (published from master with
ToolBase `.403`); the new plugin classpath also changes task classloader
hashes, so CI takes cache misses instead of the poisoned entries.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object Compiler : Dependency() {
* The version of the Compiler dependencies.
*/
override val version: String
private const val fallbackVersion = "2.0.0-SNAPSHOT.059"
private const val fallbackVersion = "2.0.0-SNAPSHOT.061"

/**
* The distinct version of the Compiler used by other build tools.
Expand All @@ -81,7 +81,7 @@ object Compiler : Dependency() {
* transitive dependencies, this is the version used to build the project itself.
*/
val dogfoodingVersion: String
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.059"
private const val fallbackDfVersion = "2.0.0-SNAPSHOT.061"

/**
* The artifact for the Compiler Gradle plugin.
Expand Down
44 changes: 22 additions & 22 deletions docs/dependencies/dependencies.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


# Dependencies of `io.spine.tools:compiler-api:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-api:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -1099,14 +1099,14 @@

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-api-tests:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-api-tests:2.0.0-SNAPSHOT.062`

## Runtime
## Compile, tests, and tooling
Expand Down Expand Up @@ -1476,14 +1476,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-backend:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-backend:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -2586,14 +2586,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-cli:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-cli:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -3855,14 +3855,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-gradle-api:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-gradle-api:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -4879,14 +4879,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-gradle-plugin:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-gradle-plugin:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -5947,14 +5947,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-jvm:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-jvm:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -7074,14 +7074,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-params:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-params:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -8172,14 +8172,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-protoc-plugin:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-protoc-plugin:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.google.code.findbugs. **Name** : jsr305. **Version** : 3.0.2.
Expand Down Expand Up @@ -9012,14 +9012,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-test-env:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-test-env:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -10118,14 +10118,14 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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.tools:compiler-testlib:2.0.0-SNAPSHOT.061`
# Dependencies of `io.spine.tools:compiler-testlib:2.0.0-SNAPSHOT.062`

## Runtime
1. **Group** : com.fasterxml.jackson. **Name** : jackson-bom. **Version** : 2.22.0.
Expand Down Expand Up @@ -11331,6 +11331,6 @@ This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using

The dependencies distributed under several licenses, are used according their commercial-use-friendly license.

This report was generated on **Tue Jul 07 17:24:16 WEST 2026** using
This report was generated on **Fri Jul 10 19:37:13 WEST 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).
6 changes: 3 additions & 3 deletions docs/dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ all modules and does not describe the project structure per-subproject.
-->
<groupId>io.spine.tools</groupId>
<artifactId>compiler</artifactId>
<version>2.0.0-SNAPSHOT.061</version>
<version>2.0.0-SNAPSHOT.062</version>

<inceptionYear>2015</inceptionYear>

Expand Down Expand Up @@ -381,12 +381,12 @@ all modules and does not describe the project structure per-subproject.
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-cli-all</artifactId>
<version>2.0.0-SNAPSHOT.059</version>
<version>2.0.0-SNAPSHOT.061</version>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
<artifactId>compiler-protoc-plugin</artifactId>
<version>2.0.0-SNAPSHOT.059</version>
<version>2.0.0-SNAPSHOT.061</version>
</dependency>
<dependency>
<groupId>io.spine.tools</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ package io.spine.tools.compiler.gradle.plugin

import io.kotest.matchers.shouldBe
import io.kotest.matchers.string.shouldContain
import io.kotest.matchers.string.shouldNotContain
import io.spine.tools.compiler.gradle.api.CompilerTaskName
import io.spine.tools.compiler.gradle.api.Names.GRADLE_PLUGIN_ID
import io.spine.testing.SlowTest
Expand Down Expand Up @@ -103,8 +104,8 @@ class PluginSpec {
createProject("empty-test")
}

private fun createLaunchTestProject() {
createProject("launch-test")
private fun createLaunchTestProject(vararg options: String) {
createProject("launch-test", *options)
}

private fun createJavaKotlinProject() {
Expand Down Expand Up @@ -165,6 +166,32 @@ class PluginSpec {
launchAndExpectResult(SUCCESS)
}

/**
* Locks the absence of the "at execution time" Gradle deprecation warnings
* formerly triggered by the [LaunchSpineCompiler] task.
*
* The 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. As of Gradle 9.6, both are deprecated:
* the `dependsOn` query fails in Gradle 10, the property mutation
* in Gradle 11.
*
* With `--warning-mode=all` Gradle prints every deprecation warning
* individually, so the assertions below fail if a regression reintroduces
* the execution-time mutation.
*/
@Test
fun `not mutate the launch task state at execution time`() {
createLaunchTestProject("--warning-mode=all")
val result = launch()

result[launchSpineCompiler] shouldBe SUCCESS
val output = result.output
output shouldNotContain
"Changing property value of task ':${launchSpineCompiler.name()}'"
output shouldNotContain "Invocation of Task.dependsOn at execution time"
}

@Test
fun `configure incremental compilation for launch task`() {
createLaunchTestProject()
Expand Down
Loading
Loading