Repository navigation
Order KSP tasks after the Protobuf code generation - #838
Merged
Merged
Conversation
`configureTaskDependencies()` now makes each KSP task depend on the Protobuf task of its source set: `kspKotlin` on `generateProto`, `kspTestKotlin` on `generateTestProto`, and `kspTestFixturesKotlin` on `generateTestFixturesProto`. KSP reads the sources that the Protobuf tasks generate, so a module that applies both plugins without the Spine Compiler failed Gradle's implicit-dependency check. The Spine Compiler already orders KSP after its launch task, which itself runs after `generateProto`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
alexander-yevsyukov
enabled auto-merge
November 5, 2026 20:07
Contributor
There was a problem hiding this comment.
🟢 Approved
The shared KSP-to-Protobuf task dependency change has no active review issues blocking approval.
No open issues 🎉
What changed in this PR
Ensures KSP runs after Protobuf source generation through the shared Gradle task-dependency configuration, removing the need for equivalent wiring in consumer modules.
Changes:
- Adds lazy dependencies for main, test, and test-fixtures KSP tasks on their corresponding Protobuf generation tasks.
- Adds tests covering all three dependencies, task registration after evaluation, and projects without Protobuf tasks.
| File | Description |
|---|---|
buildSrc/src/test/kotlin/BuildExtensionsSpec.kt |
Tests KSP-to-Protobuf dependencies and optional-task behavior. |
buildSrc/src/main/kotlin/BuildExtensions.kt |
Adds the three dependencies and reuses KSP task-name variables. |
Review effort: Balanced
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
Project.configureTaskDependencies()now orders the KSP tasks after the Protobuf code generation:kspKotlin→generateProtokspTestKotlin→generateTestProtokspTestFixturesKotlin→generateTestFixturesProtoThe edges use the function's local
String.dependOn(taskName)helper, so they are lazy and do nothing in a module that lacks either task. They sit next to the existingcompileKotlin→generateProtowiring.The test-fixtures edge has no current failure behind it. The only consumer modules with test-fixture protos and KSP use the Spine Compiler, which already orders KSP. It is included because
configureTaskDependencies()already wireskspTestFixturesKotlin, and the cause is the same for every source set.Why
KSP reads the sources that the Protobuf tasks generate. In a module that applies both protobuf and KSP, nothing ordered KSP after
generateProto, so Gradle failed the build on an implicit dependency. This came up in the scoped refresh wave closed by #836:base-librarieshad to add the wiring by hand inbase/build.gradle.kts(SpineEventEngine/base-libraries#969).In modules that use the Spine Compiler, the new edge changes nothing. The Compiler plugin already makes
kspXdepend on its launch task, and that task depends ongenerateXProto. Nothing makesgenerateProtodepend on KSP or on the Compiler, so the new edge cannot create a cycle.Consumer follow-up
After their next
./config/pull:mapOf("kspKotlin" to "generateProto", …)block inbase/build.gradle.kts).launchSpineCompiler, notgenerateProto:context/build.gradle.kts(kspKotlin→launchSpineCompiler) is already redundant, because the Spine Compiler plugin adds that edge itself.tests/validator/build.gradle.ktsadds the opposite edge (launchSpineCompiler→kspKotlin), because the Compiler consumes KSP output there. This change does not affect it.Tests
BuildExtensionsSpecgets a new group with threeProjectBuildertests:Against
master'sBuildExtensions.kt, the first two fail.🤖 Generated with Claude Code