Repository navigation
Fix the buildDependants task - #805
Merged
Merged
Conversation
The task could not check out a single repository, and had been dead for
a long time. Four defects, each of which alone was enough to break it.
1. Relative paths were resolved against the Gradle daemon.
`config-tester.gradle.kts` passed `Paths.get("./")` and `File("./tmp")`
to `ConfigTester`. Both are resolved against `user.dir`, which for
a daemon build is `~/.gradle/daemon/<version>/`. The repositories were
checked out there, and the child build aborted with "does not contain
a Gradle build". Both paths now come from `layout.projectDirectory`, and
the `tempFolder` parameter lost its `File("./tmp")` default, so that
the same hazard cannot return. `ConfigTester` now requires both paths
to be absolute.
2. A `Stream` was traversed twice.
`copyRecursively()` filtered the walked tree for directories, and then
filtered the same stream for files, which threw `IllegalStateException:
stream has already been operated upon or closed`. Only the directories
were created, so the overlaid `buildSrc` was an empty skeleton.
3. The overlay copied build output and Git metadata.
The whole project tree was copied into each checked out repository,
including `buildSrc/build` and `.git`. The latter holds the IPC sockets
of the Git file system monitor, which cannot be copied at all. The tree
is now walked with pruning, so that such a folder is not descended into.
4. The overlay replaced the `module.gradle.kts` of the repository.
`config` ships this script as an empty template that each project
replaces by its own, and `config/migrate` preserves the script of
a project when installing `buildSrc` into it. The test build did not,
so every module of a repository under test lost `java-library`, Kotlin
and Dokka, failing with "Unresolved reference `testImplementation`".
`ClonedRepoSpec` covers the copying rules and the preserved script.
All of its cases fail against the previous version of `ConfigTester`.
Co-Authored-By: Claude Opus 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. |
This was referenced Oct 19, 2026
alexander-yevsyukov
enabled auto-merge
October 19, 2026 15:07
Contributor
There was a problem hiding this comment.
🟢 Approved
No blocking issues remain; regression tests cover the repaired overlay behavior, and the reported downstream incompatibility is outside this change.
No open issues 🎉
What changed in this PR
Restores buildDependants, allowing config changes to be checked against downstream repositories.
Changes:
- Resolves checkout and source paths against the project directory.
- Repairs recursive copying, excludes generated files and Git metadata, and preserves consumer module scripts.
- Adds seven regression tests and updates usage documentation.
| File | Description |
|---|---|
| README.md | Documents project-relative path resolution. |
| buildSrc/src/test/kotlin/io/spine/gradle/ClonedRepoSpec.kt | Tests copying exclusions and module-script preservation. |
| buildSrc/src/main/kotlin/io/spine/gradle/ConfigTester.kt | Repairs overlays and requires absolute paths. |
| buildSrc/src/main/kotlin/config-tester.gradle.kts | Supplies project-rooted absolute paths. |
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.
./gradlew buildDependants— the only checkconfighas against its realconsumers — could not check out a single repository, and had been dead for a long
time. I hit this while trying to verify the dependency pins of #799 and had to fall
back to a standalone resolution probe.
Four defects, each of which alone was enough to break the task.
1. Relative paths were resolved against the Gradle daemon
config-tester.gradle.ktspassedPaths.get("./")andFile("./tmp"). Both areresolved against
user.dir, which for a daemon build is~/.gradle/daemon/<version>/.The repositories were checked out there, and the child build aborted with
"Directory '/Users/…/.gradle/daemon/9.8.1/tmp/base' does not contain a Gradle build".
Both paths now come from
layout.projectDirectory. ThetempFolderparameter lost itsFile("./tmp")default so the same hazard cannot return, andConfigTesternow requiresboth paths to be absolute.
2. A
Streamwas traversed twicecopyRecursively()filtered the walked tree for directories, then filtered the samestream for files —
IllegalStateException: stream has already been operated upon or closed. Only the directories were created, so the overlaidbuildSrcwas an emptyskeleton and the repository under test failed with unresolved references. This one could
never have worked, on any path.
3. The overlay copied build output and Git metadata
The whole project tree was copied into each checked-out repository, including
buildSrc/buildand.git— the latter holds the IPC sockets of the Git file systemmonitor, which cannot be copied at all (
Files.copythrows).The tree is now walked with pruning, so a skipped folder is not descended into.
.git,.gradleand.kotlinare skipped at any depth;buildis skipped only next toa Gradle build script, so source packages such as
io/spine/dependency/buildare copiedas usual. A link that does not resolve is skipped rather than failing the whole
overlay —
confighas such links whenever.agents/sharedis not checked out.Measured on one checkout: the copied
configoverlay went from 4.3 GB to 3.8 MB.4. The overlay replaced the
module.gradle.ktsof the repositoryconfigships that script as an empty template that each project replaces by its own, andconfig/migratepreserves a project's script when installingbuildSrcinto it. The testbuild did not, so every module of a repository under test lost
java-library, Kotlin andDokka, failing with "Unresolved reference
testImplementation". The script is nowpreserved, exactly as
migratedoes it.Verification
./gradlew detektand./gradlew -p buildSrc buildpass.ClonedRepoSpecadds 7 cases over the copying rules and the preserved script.All of them fail against the previous version of
ConfigTester../gradlew clean buildDependantsnow checks outbaseinto the project's owntmp/, overlaysbuildSrcandconfig, andbasebuilds green.What this PR does not fix
With the task working again, it immediately reports a genuine incompatibility:
base-typesat
masterreferencesToolBase.lib, whichio.spine.dependency.local.ToolBaseno longerdeclares, so its build script does not compile. That is a real downstream finding — the
kind this task exists to surface — and belongs in its own change.
Symbolic links to folders are still copied as empty folders (pre-existing; the tree is
walked without following links). This is now stated in the KDoc.
🤖 Generated with Claude Code