Skip to content

Commit

Permalink
Fix Mandrel IT runs with JDK 22-based builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jerboaa committed Oct 2, 2023
1 parent e67f2fd commit c44f3c2
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -69,6 +70,12 @@
* GraalVM Runtime Environment GraalVM CE (build 20+34-jvmci-23.0-b10)
* Substrate VM GraalVM CE (build 20+34, serial gc)
*
* or
*
* native-image 22 2024-03-19
* GraalVM Runtime Environment GraalVM CE 22-dev+15.1 (build 22+15-jvmci-b01)
* Substrate VM GraalVM CE 22-dev+15.1 (build 22+15, serial gc)
*
* @author Michal Karm Babacek <[email protected]>
*/
public class UsedVersion {
Expand Down Expand Up @@ -97,6 +104,11 @@ public static int jdkUpdate(boolean inContainer) {
// Implements version parsing after https://github.com/oracle/graal/pull/6302
static final class VersionParseHelper {

private static final Map<Integer, String> GRAAL_MAPPING = Map.of(22, "24.0",
23, "24.1",
24, "25.0",
25, "25.1");

private static final String JVMCI_BUILD_PREFIX = "jvmci-";
private static final String MANDREL_VERS_PREFIX = "Mandrel-";

Expand Down Expand Up @@ -145,7 +157,7 @@ static MVersion parse(List<String> lines) {
String vendorVersion = secondMatcher.group(VENDOR_VERSION_GROUP);

String buildInfo = secondMatcher.group(BUILD_INFO_GROUP);
String graalVersion = graalVersion(buildInfo);
String graalVersion = graalVersion(buildInfo, v.feature());
String mandrelVersion = mandrelVersion(vendorVersion);
String versNum = (isMandrel(vendorVersion) ? mandrelVersion : graalVersion);
Version vers = versionParse(versNum);
Expand Down Expand Up @@ -191,7 +203,11 @@ private static String matchVersion(String version) {
return null;
}

private static String graalVersion(String buildInfo) {
private static String graalVersion(String buildInfo, int jdkFeatureVers) {
if (jdkFeatureVers >= 22) {
// short-circuit new version scheme with a mapping
return GRAAL_MAPPING.get(Integer.valueOf(jdkFeatureVers));
}
if (buildInfo == null) {
return null;
}
Expand Down

0 comments on commit c44f3c2

Please sign in to comment.