Use AdoptOpenJDK API to Download JDKs (#55127)

This commit is contained in:
Jim Crowley 2020-04-17 14:03:14 -04:00 committed by Mark Vieira
parent 5bc8a859c6
commit 592b5516c1
No known key found for this signature in database
GPG Key ID: CA947EF7E6D4B105
2 changed files with 18 additions and 10 deletions

View File

@ -105,21 +105,29 @@ public class JdkDownloadPlugin implements Plugin<Project> {
/*
* Define the appropriate repository for the given JDK vendor and version
*
* For AdoptOpenJDK we use a single internally hosted Artifactory repository.
* For Oracle/OpenJDK we define a repository per-version.
* For Oracle/OpenJDK/AdoptOpenJDK we define a repository per-version.
*/
String repoName = REPO_NAME_PREFIX + jdk.getVendor() + "_" + jdk.getVersion();
String repoUrl;
String artifactPattern;
if (jdk.getVendor().equals("adoptopenjdk")) {
repoUrl = "https://artifactory.elstc.co/artifactory/oss-jdk-local/";
artifactPattern = String.format(
Locale.ROOT,
"adoptopenjdk/OpenJDK%sU-jdk_[classifier]_[module]_hotspot_[revision]_%s.[ext]",
jdk.getMajor(),
jdk.getBuild()
);
repoUrl = "https://api.adoptopenjdk.net/v3/binary/version/";
if (jdk.getMajor().equals("8")) {
// legacy pattern for JDK 8
artifactPattern = "jdk"
+ jdk.getBaseVersion()
+ "-"
+ jdk.getBuild()
+ "/[module]/[classifier]/jdk/hotspot/normal/adoptopenjdk";
} else {
// current pattern since JDK 9
artifactPattern = "jdk-"
+ jdk.getBaseVersion()
+ "+"
+ jdk.getBuild()
+ "/[module]/[classifier]/jdk/hotspot/normal/adoptopenjdk";
}
} else if (jdk.getVendor().equals("openjdk")) {
repoUrl = "https://download.oracle.com";
if (jdk.getHash() != null) {

View File

@ -37,7 +37,7 @@ public class AdoptOpenJdkDownloadPluginIT extends JdkDownloadPluginIT {
@Override
protected String urlPath(final String version, final String platform, final String extension) {
final String module = platform.equals("osx") ? "mac" : platform;
return "/adoptopenjdk/OpenJDK12U-jdk_x64_" + module + "_hotspot_12.0.2_10." + extension;
return "/jdk-12.0.2+10/" + module + "/x64/jdk/hotspot/normal/adoptopenjdk";
}
@Override