Skip to content

Commit 128b9c7

Browse files
committed
Revert JVM-based Gradle distribution picker, pin to 8.14.4
Replaces the per-JVM-version dispatch added in #7534 with a single hardcoded Gradle distribution. Removes the now-unused helpers and their test.
1 parent c4774bb commit 128b9c7

2 files changed

Lines changed: 1 addition & 72 deletions

File tree

rewrite-gradle-tooling-model/model/src/main/java/org/openrewrite/gradle/toolingapi/OpenRewriteModelBuilder.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static OpenRewriteModel forProjectDirectory(File projectDir, @Nullable Fi
8282
} else if (Files.exists(projectDir.toPath().resolve("gradle/wrapper/gradle-wrapper.properties"))) {
8383
connector.useBuildDistribution();
8484
} else {
85-
connector.useGradleVersion(defaultGradleVersion());
85+
connector.useGradleVersion("8.14.4");
8686
}
8787
connector
8888
// Uncomment to hit breakpoints inside OpenRewriteModelBuilder in unit tests
@@ -132,34 +132,6 @@ public static OpenRewriteModel forProjectDirectory(File projectDir, @Nullable Fi
132132
}
133133
}
134134

135-
/**
136-
* Pick a Gradle distribution compatible with the JVM running the Tooling API client.
137-
* The daemon defaults to the same JVM as the client, so the chosen distribution must support that Java version.
138-
* See <a href="https://docs.gradle.org/current/userguide/compatibility.html">Gradle compatibility matrix</a>.
139-
*/
140-
static String defaultGradleVersion() {
141-
return defaultGradleVersion(javaSpecificationVersion());
142-
}
143-
144-
static String defaultGradleVersion(int javaFeatureVersion) {
145-
if (javaFeatureVersion >= 25) {
146-
return "9.1.0";
147-
}
148-
return "8.14.3";
149-
}
150-
151-
private static int javaSpecificationVersion() {
152-
String version = System.getProperty("java.specification.version", "8");
153-
if (version.startsWith("1.")) {
154-
version = version.substring(2);
155-
}
156-
try {
157-
return Integer.parseInt(version);
158-
} catch (NumberFormatException e) {
159-
return 8;
160-
}
161-
}
162-
163135
/**
164136
* Everywhere except within openrewrite/rewrite itself the plugin will be resolved from some artifact repository
165137
* But within openrewrite/rewrite it comes from a build directory.

rewrite-gradle-tooling-model/model/src/test/java/org/openrewrite/gradle/toolingapi/OpenRewriteModelBuilderTest.java

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)