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

Fix GraalVM version checker in order to accept other implementations #37651

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ static final class VersionParseHelper {

private static final String VENDOR_VERS = "(?<VENDOR>.*)";
private static final String JDK_DEBUG = "[^\\)]*"; // zero or more of >anything not a ')'<
private static final String RUNTIME_NAME = "(?<RUNTIME>(?:OpenJDK|GraalVM) Runtime Environment) ";
private static final String RUNTIME_NAME = "(?<RUNTIME>(?:.*) Runtime Environment) ";
private static final String BUILD_INFO = "(?<BUILDINFO>.*)";
private static final String VM_NAME = "(?<VM>(?:OpenJDK 64-Bit Server|Substrate) VM) ";
private static final String VM_NAME = "(?<VM>(?:.*) VM) ";

private static final String FIRST_LINE_PATTERN = "native-image " + VSTR_FORMAT + " .*$";
private static final String SECOND_LINE_PATTERN = RUNTIME_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ public void testGraalVMVersionDetected() {
+ "GraalVM Runtime Environment GraalVM CE (build 20+34-jvmci-23.0-b10)\n"
+ "Substrate VM GraalVM CE (build 20+34, serial gc)").split("\\n"))));

// Should also work for other unknown implementations of GraalVM
assertVersion(new Version("GraalVM 23.0", "23.0", GRAALVM), GRAALVM,
Version.of(Stream.of(("native-image 20 2023-07-30\n"
+ "Foo Runtime Environment whatever (build 20+34-jvmci-23.0-b7)\n"
+ "Foo VM whatever (build 20+34, serial gc)").split("\\n"))));
assertVersion(new Version("GraalVM 23.0", "23.0", GRAALVM), GRAALVM,
Version.of(Stream.of(("native-image 20 2023-07-30\n"
+ "Another Runtime Environment whatever (build 20+34-jvmci-23.0-b7)\n"
+ "Another VM whatever (build 20+34, serial gc)").split("\\n"))));

// Older version parsing
assertVersion(new Version("GraalVM 20.1", "20.1", GRAALVM), GRAALVM,
Version.of(Stream.of("GraalVM Version 20.1.0 (Java Version 11.0.7)")));
Expand Down