Skip to content

Commit

Permalink
Switch to OpenJDK and upgrade to 18.0.1 (#86554)
Browse files Browse the repository at this point in the history
Adoptium releases are very slow to release across multiple platforms.
Switch back to Oracle's OpenJDK releases and upgrade.
  • Loading branch information
pugnascotia committed May 9, 2022
1 parent 06b3500 commit 6bef2b5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
final String module = isMac(platform) ? "mac" : platform;
return "/jdk-" + version + "/" + module + "/${arch}/jdk/hotspot/normal/adoptium";
} else if (vendor.equals(VENDOR_OPENJDK)) {
final String effectivePlatform = isMac(platform) ? "osx" : platform;
final String effectivePlatform = isMac(platform) ? "macos" : platform;
final boolean isOld = version.equals(OPENJDK_VERSION_OLD);
final String versionPath = isOld ? "jdk1/99" : "jdk12.0.1/123456789123456789123456789abcde/99";
final String filename = "openjdk-" + (isOld ? "1" : "12.0.1") + "_" + effectivePlatform + "-x64_bin." + extension(platform);
Expand All @@ -215,14 +215,21 @@ class JdkDownloadPluginFuncTest extends AbstractGradleFuncTest {
}

private static byte[] filebytes(final String vendor, final String platform) throws IOException {
final String effectivePlatform = isMac(platform) ? "osx" : platform;
final String effectivePlatform = getPlatform(vendor, platform);
if (vendor.equals(VENDOR_ADOPTIUM)) {
return JdkDownloadPluginFuncTest.class.getResourceAsStream("fake_adoptium_" + effectivePlatform + "." + extension(platform)).getBytes()
} else if (vendor.equals(VENDOR_OPENJDK)) {
JdkDownloadPluginFuncTest.class.getResourceAsStream("fake_openjdk_" + effectivePlatform + "." + extension(platform)).getBytes()
}
}

private static String getPlatform(String vendor, String platform) {
if (isMac(platform)) {
return vendor.equals(VENDOR_ADOPTIUM) ? "osx" : "macos";
}
return platform;
}

private static boolean isMac(String platform) {
platform.equals("darwin") || platform.equals("mac")
}
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public class Jdk implements Buildable, Iterable<File> {
private static final List<String> ALLOWED_ARCHITECTURES = List.of("aarch64", "x64");
private static final List<String> ALLOWED_VENDORS = List.of("adoptium", "openjdk");
private static final List<String> ALLOWED_PLATFORMS = List.of("darwin", "linux", "windows", "mac");
private static final Pattern VERSION_PATTERN = Pattern.compile("(\\d+)(\\.\\d+\\.\\d+)?\\+(\\d+(?:\\.\\d+)?)(@([a-f0-9]{32}))?");
private static final Pattern VERSION_PATTERN = Pattern.compile(
"(\\d+)(\\.\\d+\\.\\d+(?:\\.\\d+)?)?\\+(\\d+(?:\\.\\d+)?)(@([a-f0-9]{32}))?"
);
private static final Pattern LEGACY_VERSION_PATTERN = Pattern.compile("(\\d)(u\\d+)\\+(b\\d+?)(@([a-f0-9]{32}))?");

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static NamedDomainObjectContainer<Jdk> getContainer(Project project) {

private static String dependencyNotation(Jdk jdk) {
String platformDep = jdk.getPlatform().equals("darwin") || jdk.getPlatform().equals("mac")
? (jdk.getVendor().equals(VENDOR_ADOPTIUM) ? "mac" : "osx")
? (jdk.getVendor().equals(VENDOR_ADOPTIUM) ? "mac" : "macos")
: jdk.getPlatform();
String extension = jdk.getPlatform().equals("windows") ? "zip" : "tar.gz";

Expand Down
4 changes: 2 additions & 2 deletions build-tools-internal/version.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
elasticsearch = 8.2.1
lucene = 9.1.0

bundled_jdk_vendor = adoptium
bundled_jdk = 18+36
bundled_jdk_vendor = openjdk
bundled_jdk = 18.0.1.1+2@65ae32619e2f40f3a9af3af1851d6e19

checkstyle = 9.3

Expand Down
5 changes: 5 additions & 0 deletions docs/changelog/86554.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 86554
summary: Switch to OpenJDK and upgrade to 18.0.1
area: Packaging
type: upgrade
issues: []

0 comments on commit 6bef2b5

Please sign in to comment.