Inherit publishing destinations when a module leaves them unset - #765
Merged
Merged
Conversation
`SpinePublishing.publishTo()` is a member extension of `Project`, so the
unqualified `destinations` it returned bound to the extension running
`configured()`, not to the `ext` it had just found on the project.
A module opening its own `spinePublishing { customPublishing = true }`
without `destinations` walked up to the root, found the root's set, and
then read its own uninitialized one, failing the build with
`UninitializedPropertyAccessException` instead of inheriting.
The existing test called `publishTo()` only through the root extension,
where both receivers are the same object, so it could not catch this.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With `publishTo()` inheriting correctly, the module no longer needs `destinations = rootProject.the<SpinePublishing>().destinations`: the walk from the module reaches the root and returns the same set. The reconfiguration TestKit fixture models this script, so its module now leaves `destinations` unset too. That makes it a real-build check of the inheritance: without the previous commit, it fails with `UninitializedPropertyAccessException`. 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
requested review from
armiol
and
a lite review from Copilot
September 24, 2026 16:40
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Add coverage for initialized extensions with different destination sets.
Review effort: Lite
Findings: None
What changed in this PR
Fixes publishing destination inheritance for module-local SpinePublishing extensions.
Changes:
- Corrects
publishTo()destination lookup. - Removes redundant destination copying.
- Adds unit and integration coverage.
| File | Summary |
|---|---|
buildSrc/src/test/kotlin/io/spine/gradle/publish/SpinePublishingTest.kt |
Tests destination inheritance. |
buildSrc/src/test/kotlin/io/spine/gradle/publish/PublicationChecksumsReconfigurationIgTest.kt |
Verifies the integration scenario. |
buildSrc/src/main/kotlin/uber-jar-module.gradle.kts |
Removes redundant destination configuration. |
buildSrc/src/main/kotlin/io/spine/gradle/publish/SpinePublishing.kt |
Fixes destination resolution. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The review asked for coverage of two initialized extensions with different destination sets. Before the fix, when the root extension configured a module that had opened its own `spinePublishing` with other `destinations`, the unqualified `destinations` returned the root's set, without any error. The new test calls `publishTo()` for such a subproject through the root extension and expects the subproject's set. Without the fix it fails, getting `[root-repo]` instead of `sub-repo`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alexander-yevsyukov
enabled auto-merge
September 24, 2026 16:59
armiol
approved these changes
Sep 24, 2026
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
SpinePublishing.publishTo()now returns the destinations of the extension it found on the project (ext.destinations), not those of the extension runningconfigured().SpinePublishing.kt: the fix, one token.SpinePublishingTest: a new case. A subproject has its own extension withdestinationsunset, and the root extension has them set.publishTo()called through the subproject's extension must return the root's set.uber-jar-module.gradle.kts: removesdestinations = rootProject.the<SpinePublishing>().destinations, and the import only that line used.PublicationChecksumsReconfigurationIgTest: this fixture copies theuber-jar-modulepattern, so its module now leavesdestinationsunset too. That makes it a real-build check of the inheritance. A formatter also removed a stray double blank line there.Why
publishTo()is aProjectextension declared insideSpinePublishing, so it has two implicit receivers.Projecthas nodestinations, so the bare name resolved tothis@SpinePublishing, the extension runningconfigured(), instead ofext. That caused two problems:spinePublishing { customPublishing = true }withoutdestinationswalked up to the root and found the root's set. It then read its own uninitialized one, and the build failed withUninitializedPropertyAccessExceptionduring configuration. That's whyuber-jar-module.gradle.kts, and three modules inlogging, copied the root's destinations by hand.configured()haddestinationsset and the project's own extension had a different set, the wrong set was used, with no error.The existing test called
publishTo()only through the root extension. There both receivers are the same object, so the test couldn't catch either problem.The function has to stay a member:
ext::destinations.isInitializedcompiles only inside the class that declares the property. I checked this; a top-level version fails with "Backing field … is not accessible at this point".Reviewer notes
masterwithUninitializedPropertyAccessExceptionand pass with the fix.tool-baseappliesuber-jar-modulein five modules. They're all direct children of a root that setsdestinationsand lists them inmodulesWithCustomPublishing, so they get the same set as before.SpinePublishingor nodestinations, the removed line used to fail loudly. Now the module gets an empty set and isn't published to any remote repository, with only aninfolog. Every other module already behaves this way.logging: after its next./config/pull,logging,logging-testlibandotel-backendcan drop their hand-copieddestinations.master(Publish an SPDX SBOM with each Maven publication #764). There's no conflict, and I checked the merged result locally (origin/masterplus this diff)::buildSrc:build detektpasses, 111 tests, 0 failures.masterrequires branches to be up to date, so this needs Update branch before it can merge.Verification
./gradlew :buildSrc:build detekton JDK 17: 99 tests, 0 failures, detekt clean. CI in this repository runs only detekt, not thebuildSrctests.🤖 Generated with Claude Code