Pin Tooling-API client default to Gradle 8.14.3#7537
Merged
Conversation
Replaces the per-JVM-version dispatch added in #7534 with a single hardcoded Gradle distribution. Removes the now-unused helpers and their test.
Member
Author
|
It turns out Gradle 8.x saw a backport of Java 25 support in 8.14.4, which was missed earlier. Proven to work downstream, and simpler than working around the dropped |
This was referenced May 1, 2026
Gradle 9 dropped -b. When the caller passes a build file at a non-conventional location, write a temporary settings.gradle with only rootProject.buildFileName, deleting it in the same finally block as the init script.
Determine the Gradle version from the explicit useGradleVersion call or from gradle-wrapper.properties when useBuildDistribution is in play. Existing tests on Gradle 8 keep using -b. The settings.gradle path now writes with CREATE_NEW so it can never overwrite a user-supplied file, and the cleanup deletes only files we actually wrote (settingsWritten flag).
Move the Files.write call up into the same block that decides we need a temporary settings file, and collapse the two nested try/finally blocks into one outer finally that handles both init and settings cleanup. settingsWritten still gates the delete so a race-introduced or pre-existing user file is never touched.
8.14.4 has a Kotlin DSL regression that breaks `plugins {}` blocks with
local `val` declarations (16 :rewrite-gradle:test failures); 8.14.3 has
no such regression and matches the pre-#7534 default for Java < 25.
Member
Author
|
Merging already after tests with downstream projects to avoid longer unavailability of builds & snapshots downstream. |
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.
Summary
8.14.3(was briefly8.14.4on this branch — see below).defaultGradleVersion()/javaSpecificationVersion()helpers and the test class that only exercised them.wrapperGradleVersion()/isGradle9OrLater()codepath so that callers that supply agradle-wrapper.propertiespointing at Gradle 9 still get the right CLI shape (see Gradle 9 note below). With the 8.14.3 default this code is inert until a wrapper opts in.Why not 8.14.4 or 9.x?
8.14.4: Kotlin DSL regression
Gradle 8.14.4 introduced a Kotlin DSL compilation regression that breaks
plugins {}blocks containing localvaldeclarations. The Kotlin script compiler fails to resolve thePluginDependenciesSpecScopesupertype:This caused 16
:rewrite-gradle:testfailures on this branch (e.g.UpgradePluginVersionTest.upgradeKotlinPluginLocalVariable,UpgradeTransitiveDependencyVersionTest.kotlinDslAddConstraint). The same suite passes against 8.14.3.9.x: CLI shape changed
Gradle 9 dropped the
-b <buildFile>argument used byOpenRewriteModelBuilderto point at non-conventional build files. The replacement is to declarerootProject.buildFileNameinsettings.gradle, which forces the Tooling API client to synthesize a settings file for tests that don't ship one. Going to 9.x by default would also raise the minimum daemon JVM and force every consumer onto a major upgrade, which is more change than this PR wants to land. The new helpers inOpenRewriteModelBuilder(isGradle9OrLater, settings.gradle writeback) are kept so consumers who do opt into Gradle 9 via their own wrapper still work.8.14.3: no known regressions
8.14.3 is the same minor the picker chose for Java < 25 before #7534 was reverted, so this PR is a strict simplification of behavior that was already shipping on
main. CI runs on Java 21 and Java 25; therewrite-gradletest JVM is pinned to a Java 21 toolchain so 8.14.3 is JVM-compatible in both matrix legs.Test plan
:rewrite-gradle:testpasses against 8.14.3 (the same suite exhibited the 8.14.4 Kotlin DSL failures).