Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve GraalVM version check. #646

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class NativeImageUtils {

private static final Pattern requiredVersionPattern = Pattern.compile("^([0-9]+)(?:\\.([0-9]+)?)?(?:\\.([0-9]+)?)?$");

private static final Pattern graalvmVersionPattern = Pattern.compile("^(GraalVM|native-image) ([0-9]+)\\.([0-9]+)\\.([0-9]+).*");
private static final Pattern graalvmVersionPattern = Pattern.compile("^(GraalVM|native-image) ([0-9]+)\\.([0-9]+)\\.([0-9]+).*", Pattern.DOTALL);

private static final Pattern javaVersionPattern = Pattern.compile("^native-image ([0-9]+).*", Pattern.DOTALL);
private static final Pattern javaVersionLegacyPattern = Pattern.compile(".* \\(Java Version ([0-9]+)\\.([0-9]+)\\.([0-9]+).*");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ void checkOracleGraalVMVersion() {
Assertions.assertEquals(21, NativeImageUtils.getMajorJDKVersion(oracleGraalVMForJDK21));
}

@Test
void checkOtherGraalVMVersion() {
String otherGraalVMForJDK23 = "native-image 23.0.1 2024-10-15\nJava(TM) SE Runtime Environment Foo Bar 23.0.1+11.1 (build 23.0.1+11-foo-bar-jvmci-b01)\n" +
"Java HotSpot(TM) 64-Bit Server VM Foo Bar 23.0.1+11.1 (build 23.0.1+11-foo-bar-jvmci-b01, mixed mode, sharing)";
NativeImageUtils.checkVersion("22.3.0", otherGraalVMForJDK23);
NativeImageUtils.checkVersion("23", otherGraalVMForJDK23);
NativeImageUtils.checkVersion("23.0", otherGraalVMForJDK23);
NativeImageUtils.checkVersion("23.0.1", otherGraalVMForJDK23);
Assertions.assertEquals(23, NativeImageUtils.getMajorJDKVersion(otherGraalVMForJDK23));
}

@Test
void checkGreaterVersion() {
NativeImageUtils.checkVersion("22", "GraalVM 23.2.1");
Expand Down