Skip to content

Commit

Permalink
Added Adoptium JDK8 support and updated DistroTestPlugin JDK version …
Browse files Browse the repository at this point in the history
…used by Gradle (#3323)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
reta authored May 13, 2022
1 parent 7d19426 commit 963b1f3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/org/opensearch/gradle/Jdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class Jdk implements Buildable, Iterable<File> {
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 static final Pattern LEGACY_VERSION_PATTERN = Pattern.compile("(\\d)(u\\d+)(?:\\+|\\-)(b\\d+?)(@([a-f0-9]{32}))?");

private final String name;
private final Configuration configuration;
Expand Down
48 changes: 32 additions & 16 deletions buildSrc/src/main/java/org/opensearch/gradle/JdkDownloadPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,38 @@ private void setupRepository(Project project, Jdk jdk) {

if (jdk.getVendor().equals(VENDOR_ADOPTIUM)) {
repoUrl = "https://github.com/adoptium/temurin" + jdk.getMajor() + "-binaries/releases/download/";
// JDK updates are suffixed with 'U' (fe OpenJDK17U), whereas GA releases are not (fe OpenJDK17).
// To distinguish between those, the GA releases have only major version component (fe 17+32),
// the updates always have minor/patch components (fe 17.0.1+12), checking for the presence of
// version separator '.' should be enough.
artifactPattern = "jdk-"
+ jdk.getBaseVersion()
+ "+"
+ jdk.getBuild()
+ "/OpenJDK"
+ jdk.getMajor()
+ (jdk.getBaseVersion().contains(".") ? "U" : "")
+ "-jdk_[classifier]_[module]_hotspot_"
+ jdk.getBaseVersion()
+ "_"
+ jdk.getBuild()
+ ".[ext]";

if (jdk.getMajor().equals("8")) {
// JDK-8 updates are always suffixed with 'U' (fe OpenJDK8U).
artifactPattern = "jdk"
+ jdk.getBaseVersion()
+ "-"
+ jdk.getBuild()
+ "/OpenJDK"
+ jdk.getMajor()
+ "U"
+ "-jdk_[classifier]_[module]_hotspot_"
+ jdk.getBaseVersion()
+ jdk.getBuild()
+ ".[ext]";
} else {
// JDK updates are suffixed with 'U' (fe OpenJDK17U), whereas GA releases are not (fe OpenJDK17).
// To distinguish between those, the GA releases have only major version component (fe 17+32),
// the updates always have minor/patch components (fe 17.0.1+12), checking for the presence of
// version separator '.' should be enough.
artifactPattern = "jdk-"
+ jdk.getBaseVersion()
+ "+"
+ jdk.getBuild()
+ "/OpenJDK"
+ jdk.getMajor()
+ (jdk.getBaseVersion().contains(".") ? "U" : "")
+ "-jdk_[classifier]_[module]_hotspot_"
+ jdk.getBaseVersion()
+ "_"
+ jdk.getBuild()
+ ".[ext]";
}
} else if (jdk.getVendor().equals(VENDOR_ADOPTOPENJDK)) {
repoUrl = "https://api.adoptopenjdk.net/v3/binary/version/";
if (jdk.getMajor().equals("8")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
import java.util.stream.Stream;

public class DistroTestPlugin implements Plugin<Project> {
private static final String SYSTEM_JDK_VERSION = "8u242+b08";
private static final String SYSTEM_JDK_VENDOR = "adoptopenjdk";
private static final String SYSTEM_JDK_VERSION = "8u332-b09";
private static final String SYSTEM_JDK_VENDOR = "adoptium";
private static final String GRADLE_JDK_VERSION = "11.0.15+10";
private static final String GRADLE_JDK_VENDOR = "adoptium";

Expand Down

0 comments on commit 963b1f3

Please sign in to comment.