From b4eb722c7b15752a0310d68368726d2b3de9eece Mon Sep 17 00:00:00 2001 From: Bruno Caballero Date: Mon, 11 Dec 2023 11:19:11 +0100 Subject: [PATCH 1/2] Fix GrasalVM version checker in order to accept other implementations --- .../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)"))); From aefe8a3fb83d0e75f66946a93622a35a8231de27 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Mon, 11 Dec 2023 17:48:34 +0200 Subject: [PATCH 2/2] Add test for GraalVM EE dev builds --- .../quarkus/deployment/pkg/steps/GraalVMTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 09b687e03d459..2914dfe0ee7cb 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 @@ -140,6 +140,19 @@ public void testGraalVM22DevVersionParser() { assertThat(graalVM22Dev.javaVersion.update()).isEqualTo(0); } + @Test + public void testGraalVMEE22DevVersionParser() { + Version graalVMEE22Dev = Version.of(Stream.of(("native-image 22 2024-03-19\n" + + "Java(TM) SE Runtime Environment Oracle GraalVM 22-dev+25.1 (build 22+25-jvmci-b01)\n" + + "Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 22-dev+25.1 (build 22+25-jvmci-b01, mixed mode, sharing)") + .split("\\n"))); + assertThat(graalVMEE22Dev.distribution.name()).isEqualTo("GRAALVM"); + assertThat(graalVMEE22Dev.getVersionAsString()).isEqualTo("24.0-dev"); + assertThat(graalVMEE22Dev.javaVersion.toString()).isEqualTo("22+25-jvmci-b01"); + assertThat(graalVMEE22Dev.javaVersion.feature()).isEqualTo(22); + assertThat(graalVMEE22Dev.javaVersion.update()).isEqualTo(0); + } + @Test public void testGraalVMVersionsOlderThan() { assertOlderThan("GraalVM Version 19.3.6 CE", "GraalVM Version 20.2.0 (Java Version 11.0.9)");