Migrate Gradle build scripts to Kotlin DSL with build-logic convention plugins - #3044
Open
Goooler wants to merge 8 commits into
Open
Migrate Gradle build scripts to Kotlin DSL with build-logic convention plugins#3044Goooler wants to merge 8 commits into
Goooler wants to merge 8 commits into
Conversation
Goooler
force-pushed
the
g/20260908/composite-build
branch
from
September 8, 2026 15:04
30c19dd to
870c43f
Compare
The Kotlin DSL migration replaced Groovy's String.decodeBase64() with
java.util.Base64.getDecoder(). Groovy's decoder skips whitespace; the
basic JDK decoder throws IllegalArgumentException on it.
deploy.yml documents GPG_KEY64 as being produced by
gpg --export-secret-keys --armor KEY_ID | openssl base64
and `openssl base64` wraps at 64 chars unless given -A, so that secret is
multi-line and decode64 would have blown up at configuration time.
This is only reachable on a real `-Prelease=true` publish (the other
branch sets signing required=false), so no CI job exercises it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7g6GGwdERtY12UeJDrUxj
The migration turned `project.ext.artifactId` (which throws when unset)
into `findProperty("artifactId")?.toString() ?: project.name`. A project
that forgot to set it would silently publish as
`com.diffplug.spotless:lib` rather than failing the build. Same for
`org`, which had a hardcoded "diffplug" fallback in one place and no
fallback at all in the four pom url/scm interpolations, where a missing
value would have rendered the literal string "null".
Also drops the dead `?: "spotless"` fallback on `name`: findProperty
resolves Project's own getName() bean property before the extra property
from gradle.properties, so it returned "lib"/"plugin-gradle" and the
javadoc header linked to https://github.com/diffplug/lib. The rest of
the file already builds that URL as `$org/${rootProject.name}`, so use
that here too.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7g6GGwdERtY12UeJDrUxj
The Groovy build applied java-publish at the very bottom of plugin-gradle/build.gradle, with the comment "have to apply java-publish after setting up the pluginBundle". The migration moved it into the plugins block, i.e. applied first, and dropped the comment. It still works, but only because the publishing config is wrapped in afterEvaluate and java-gradle-plugin is declared earlier in the plugins block, so its afterEvaluate runs first and creates 'pluginMaven'. If that ever inverts, the elvis branch created the publication with `if (!isPluginGradle) from(components["java"])` -- i.e. with no artifacts at all -- and we would publish a POM with no jar instead of failing. Make the invariant explicit with a check(), and restore the ordering comment at the call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G7g6GGwdERtY12UeJDrUxj
Groovy's String.toBoolean() accepts "true", "y" and "1" ignoring case; Kotlin's toBoolean() accepts only "true". The migration swapped them, so `error-prone=1` no longer enabled error-prone and `SPOTLESS_EXCLUDE_MAVEN=1` no longer excluded the maven plugin -- both silently, as no-ops. Note this also widens the -P form of SPOTLESS_EXCLUDE_MAVEN, which used strict Boolean.valueOf before. That direction can't break an existing invocation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G7g6GGwdERtY12UeJDrUxj
The script calls tasks.named<Test>("test") and registers Test tasks at
apply time, but only declared com.adarshr.test-logger. It works today
purely because every consumer happens to declare java-library (or
maven-plugin-development) earlier in its plugins block; reordering would
fail with an UnknownTaskException that points nowhere useful.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G7g6GGwdERtY12UeJDrUxj
The Kotlin DSL rewrite carried the behavior across faithfully but lost most of the "why" along the way. These are the ones that answer a question the code can't: - error-prone: the issue links behind disableAllWarnings (spotless#2745, google/error-prone#5365), which of the disables are there because we don't want ErrorProne's annotations, and the excludedPaths note about the dirty-file/up-to-date bug - java-setup: the spotbugs detector doc URLs for ConstructorThrow and FindReturnRef, the reportLevel scale, "bug free or it doesn't ship!" - java-publish: why javadoc warnings are off, why check depends on javadoc, the Maven 3.1.0 prerequisite, and both changelog ordering constraints - changelog: the one-changelog-per-tag rule and the -Prelease=true requirement - special-tests: the pointer to com.diffplug.spotless.tag, the up-to-date-checking and parallel-forks notes - freshmark: why the second FreshMarkExtension exists and uses versionNext as versionLast Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G7g6GGwdERtY12UeJDrUxj
Member
|
I made some edits, this LGTM now @Goooler. I'll let you click merge if you agree with the changes. Main thing was Base64 decoding with spaces & newlines. |
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.
Relands #2876.