Repository navigation
Fix removed archivesBaseName property read in test-app - #422
Conversation
Project.archivesBaseName was removed in Gradle 9. The Gradle 9 migration converted the setters in test-app/build.gradle but missed this reader, which sits inside the versions.useRepo guard and so only runs in publishing builds.
|
Verified on CI: I ran the Snapshot job rather than Alpha/Milestone on purpose: it exercises the identical The eight per-platform
For comparison, the same step on master failed with |
Unblocks the
milestone-30publish Mikhail Lopatkin is waiting on.Failing build: https://builds.gradle.org/buildConfiguration/GradleNative_NativePlatform_Publishing_PublishJavaApiAlpha/117007595
Root cause
Project.archivesBaseNamewas removed in Gradle 9, and this build is on 9.4.1.The Gradle 9 migration (dfe6952, "Migrate to gradle 9") converted the setter usages in
test-app/build.gradle:…but missed the remaining reader at
test-app/build.gradle:25. The error surfaces againstDefaultDependencyHandlerbecause that's the innermost delegate in the enclosingdependencies {}closure.Blast radius
Worth being precise about this, because the failing line lives in
test-appbut that is not where the build actually breaks.PublishJavaApiAlphaitself only reportedSnapshot dependencies failed: 5. The real failures were in all eight per-platform Alpha jobs, in the:native-platform:uploadJni/:native-platform:uploadNcursesJnisteps — e.g. 117007587, whose build problem is the identicalarchivesBaseNameexception.That's expected:
test-app/build.gradleis evaluated during the configuration phase regardless of which project's task you invoke, so a broken line in it fails every task in the build. The one-line fix therefore unblocks the entire publish matrix, not just:test-app:uploadMain.Why only publishing jobs hit it
The block is guarded by
versions.useRepo, andgradlebuild.VersionDetails.isUseRepo()is true only for the Snapshot/Alpha/Milestone/Release build types. Ordinary dev and CI test builds never configure it, which is why this went unnoticed since December.The fix
Read the value from the
baseextension, which is already configured at line 12 of the same file:download "$group:${base.archivesName.get()}:${version}"PublishPlugin.getArchivesBaseName(Project)in buildSrc does the same thing viaBasePluginExtension.getArchivesName(); using the extension directly from the Groovy DSL is equivalent and avoids pulling a buildSrc import into the script.Verification
Reproduced locally before the fix (a dummy
publishTokenis needed to get pastReleasePlugin's configuration-time credential check and reach:test-app):After the fix, both the snapshot and the alpha/milestone path configure cleanly, and the dependency resolves to the intended coordinates:
(The
FAILEDmarker is just the artifact not being published yet — the point is that the coordinates are now built correctly. Configuration-time success is what was broken.)A plain
./gradlew :test-app:helpdev build is unaffected, as the changed line sits inside theuseRepoguard.CI verification on this branch:
PublishJavaApiSnapshot#189 — SUCCESS, all 17 builds in the dependency graph green onbdc12fc9, published0.22-snapshot-20260906135345+0000.I used the Snapshot job rather than Alpha/Milestone deliberately: it exercises the identical
versions.useRepocode path (isUseRepo()is true for both) and runs the same:native-platform:uploadJniand:test-app:uploadMainsteps, but publishes a disposable timestamped snapshot tolibs-snapshots-localinstead of writing tolibs-releases-local. In particular it avoids consuming themilestone-30coordinate from an unmerged branch.The eight per-platform
uploadJnipublishes — the exact jobs that failed on master — all passed:PublishMacOsAarch64SnapshotPublishMacOsAmd64SnapshotPublishLinuxAmd64SnapshotPublishLinuxAarch64SnapshotPublishLinuxAmd64Ncurses6SnapshotPublishLinuxAarch64Ncurses5SnapshotPublishWindowsAmd64SnapshotPublishFreeBsdAmd64SnapshotScope
I grepped the repo for other Gradle-9-removed APIs that would only be exercised on the
versions.useRepo/ publishing path —archivesBaseName,libsDir,distsDir,mainClassName,uploadArchives,getConvention(),archiveName/destinationDir/classesDir,project.buildDir, and the removedcompile/runtime/testCompileconfigurations. This line was the only hit;versions.useRepoitself appears nowhere else. No other changes needed.One caveat on that sweep: this bug's signature is dynamic Groovy property resolution, which static grepping cannot fully rule out — it only fails at configuration time, on a code path that no dev or CI build exercises. The durable guard would be a cheap CI job running a configuration-only task with
-Psnapshot, which would have caught this in December. Out of scope here, but worth considering separately.