From de9e90c46c087509c33284c64de9010bdc5cb6eb Mon Sep 17 00:00:00 2001 From: Bruno Caballero Date: Mon, 11 Dec 2023 11:19:11 +0100 Subject: [PATCH] Fix GrasalVM version checker in order to accept other implementations (cherry picked from commit b4eb722c7b15752a0310d68368726d2b3de9eece) --- .../java/io/quarkus/deployment/pkg/steps/GraalVM.java | 4 ++-- .../io/quarkus/deployment/pkg/steps/GraalVMTest.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java index d711928b67b39..6b9be123db6b3 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java @@ -31,9 +31,9 @@ static final class VersionParseHelper { private static final String VENDOR_VERS = "(?.*)"; private static final String JDK_DEBUG = "[^\\)]*"; // zero or more of >anything not a ')'< - private static final String RUNTIME_NAME = "(?(?:OpenJDK|GraalVM) Runtime Environment) "; + private static final String RUNTIME_NAME = "(?(?:.*) Runtime Environment) "; private static final String BUILD_INFO = "(?.*)"; - private static final String VM_NAME = "(?(?:OpenJDK 64-Bit Server|Substrate) VM) "; + private static final String VM_NAME = "(?(?:.*) VM) "; private static final String FIRST_LINE_PATTERN = "native-image " + VSTR_FORMAT + " .*$"; private static final String SECOND_LINE_PATTERN = RUNTIME_NAME diff --git a/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java b/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java index 7bb5a88fea6be..09b687e03d459 100644 --- a/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java +++ b/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java @@ -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)")));