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 2487ddbcff85b..d2c4a15725048 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 @@ -126,7 +126,6 @@ public static final class Version implements Comparable { "(GraalVM|native-image)( Version)? " + VersionParseHelper.VERS_FORMAT + "(?.*?)?" + "(\\(Java Version (?[0-9]+)(\\.(?[0-9]*)\\.(?[0-9]*))?.*)?$"); - static final Version UNVERSIONED = new Version("Undefined", "snapshot", Distribution.ORACLE); static final Version VERSION_21_3 = new Version("GraalVM 21.3", "21.3", Distribution.ORACLE); static final Version VERSION_21_3_0 = new Version("GraalVM 21.3.0", "21.3.0", Distribution.ORACLE); public static final Version VERSION_22_3_0 = new Version("GraalVM 22.3.0", "22.3.0", Distribution.ORACLE); @@ -160,10 +159,6 @@ String getFullVersion() { return fullVersion; } - boolean isDetected() { - return this != UNVERSIONED; - } - boolean isObsolete() { return this.compareTo(MINIMUM) < 0; } @@ -204,10 +199,7 @@ static Version of(Stream output) { if (lines.size() == 3) { // Attempt to parse the new 3-line version scheme first. - Version v = VersionParseHelper.parse(lines); - if (v != VersionParseHelper.UNKNOWN_VERSION) { - return v; - } + return VersionParseHelper.parse(lines); } else if (lines.size() == 1) { // Old, single line version parsing logic final String line = lines.get(0); @@ -234,7 +226,8 @@ static Version of(Stream output) { } } - return UNVERSIONED; + throw new IllegalArgumentException( + "Cannot parse version from output: " + output.collect(Collectors.joining("\n"))); } private static boolean isMandrel(String s) { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 948a5952fa5dc..25f2ee179e2da 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -216,12 +216,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, LocalesBuildTimeCon buildRunner.setup(processInheritIODisabled.isPresent() || processInheritIODisabledBuildItem.isPresent()); final GraalVM.Version graalVMVersion = buildRunner.getGraalVMVersion(); - - if (graalVMVersion.isDetected()) { - checkGraalVMVersion(graalVMVersion); - } else { - log.error("Unable to get GraalVM version from the native-image binary."); - } + checkGraalVMVersion(graalVMVersion); try { if (nativeConfig.cleanupServer()) { @@ -568,7 +563,7 @@ static class Builder { private Path outputDir; private String runnerJarName; private String noPIE = ""; - private GraalVM.Version graalVMVersion = GraalVM.Version.UNVERSIONED; + private GraalVM.Version graalVMVersion = null; private String nativeImageName; private boolean classpathIsBroken; private boolean containerBuild; 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 f795aab93638d..e1692954aee86 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 @@ -86,7 +86,6 @@ public void testGraalVMVersionDetected() { } static void assertVersion(org.graalvm.home.Version graalVmVersion, Distribution distro, Version version) { - assertThat(version.isDetected()).isEqualTo(true); assertThat(graalVmVersion.compareTo(version.version)).isEqualTo(0); assertThat(version.distribution).isEqualTo(distro); if (distro == MANDREL) { @@ -94,11 +93,6 @@ static void assertVersion(org.graalvm.home.Version graalVmVersion, Distribution } } - @Test - public void testGraalVMVersionUndetected() { - assertThat(Version.of(Stream.of("foo bar")).isDetected()).isFalse(); - } - @Test public void testGraalVMVersionsOlderThan() { assertOlderThan("GraalVM Version 19.3.6 CE", "GraalVM Version 20.2.0 (Java Version 11.0.9)");