Enable Gradle plugin tests on Java 20

Closes gh-35931
pull/37018/head
Scott Frederick 1 year ago
parent 0fd1c89889
commit fbba2df7bf

@ -136,5 +136,5 @@ artifacts {
} }
toolchain { toolchain {
maximumCompatibleJavaVersion = JavaLanguageVersion.of(18) maximumCompatibleJavaVersion = JavaLanguageVersion.of(20)
} }

@ -19,6 +19,7 @@ package org.springframework.boot.testsupport.gradle.testkit;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.gradle.api.JavaVersion;
import org.gradle.util.GradleVersion; import org.gradle.util.GradleVersion;
/** /**
@ -31,7 +32,11 @@ public final class GradleVersions {
private GradleVersions() { private GradleVersions() {
} }
@SuppressWarnings("UnstableApiUsage")
public static List<String> allCompatible() { public static List<String> allCompatible() {
if (isJavaVersion(JavaVersion.VERSION_20)) {
return Arrays.asList("8.1.1", "8.2-rc-1");
}
return Arrays.asList("7.5.1", GradleVersion.current().getVersion(), "8.0.2", "8.1.1", "8.2-rc-1"); return Arrays.asList("7.5.1", GradleVersion.current().getVersion(), "8.0.2", "8.1.1", "8.2-rc-1");
} }
@ -39,4 +44,8 @@ public final class GradleVersions {
return allCompatible().get(0); return allCompatible().get(0);
} }
private static boolean isJavaVersion(JavaVersion version) {
return JavaVersion.current().isCompatibleWith(version);
}
} }

Loading…
Cancel
Save