Skip to content

Commit 14fca6b

Browse files
authored
Merge pull request #48412 from zakkak/2025-06-16-drop-old-version-parsing
Drop version parsing code for no longer supported GraalVM versions
2 parents 7e64426 + de7d1e1 commit 14fca6b

File tree

2 files changed

+110
-110
lines changed

2 files changed

+110
-110
lines changed

core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/GraalVM.java

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,6 @@ public static final class Version extends io.quarkus.runtime.graal.GraalVM.Versi
170170
// Get access to GRAAL_MAPPING without making it public
171171
private static final Map<String, String> GRAAL_MAPPING = io.quarkus.runtime.graal.GraalVM.Version.GRAAL_MAPPING;
172172

173-
/**
174-
* JDK version used with native-image tool:
175-
* e.g. JDK 17.0.1 is Feature version 17, Update version 1.
176-
* * Feature: e.g. 11 as in JDK 11, JDK 17, JDK 18 etc.
177-
* * Interim: 0 so far for the JDK versions we care about, not used here
178-
* * Update: quarterly updates, e.g. 13 as in JDK 11.0.13.
179-
* * Patch: emergency release, critical patch, not used here
180-
*/
181-
private static final Pattern OLD_VERS_PATTERN = Pattern.compile(
182-
"(GraalVM|native-image)( Version)? " + VersionParseHelper.VERS_FORMAT + "(?<distro>.*?)?" +
183-
"(\\(Java Version (?<javaversion>(?<jfeature>[0-9]+)(\\.(?<jinterim>[0-9]*)\\.(?<jupdate>[0-9]*))?.*)\\))?$");
184-
185-
static final Version VERSION_21_3 = new Version("GraalVM 21.3", "21.3", Distribution.GRAALVM);
186-
static final Version VERSION_21_3_0 = new Version("GraalVM 21.3.0", "21.3.0", Distribution.GRAALVM);
187173
public static final Version VERSION_23_0_0 = new Version("GraalVM 23.0.0", "23.0.0", "17", Distribution.GRAALVM);
188174
public static final Version VERSION_23_1_0 = new Version("GraalVM 23.1.0", "23.1.0", "21", Distribution.GRAALVM);
189175
public static final Version VERSION_24_0_0 = new Version("GraalVM 24.0.0", "24.0.0", "22", Distribution.GRAALVM);
@@ -275,45 +261,16 @@ public static Version of(Stream<String> output) {
275261
.toList();
276262

277263
if (lines.size() == 3) {
278-
// Attempt to parse the new 3-line version scheme first.
279264
Version parsedVersion = VersionParseHelper.parse(lines);
280265
if (parsedVersion != VersionParseHelper.UNKNOWN_VERSION) {
281266
return parsedVersion;
282267
}
283-
} else if (lines.size() == 1) {
284-
// Old, single line version parsing logic
285-
final String line = lines.get(0);
286-
final Matcher oldVersMatcher = OLD_VERS_PATTERN.matcher(line);
287-
if (oldVersMatcher.find()) {
288-
// GraalVM/Mandrel old, single line, version scheme:
289-
final String version = oldVersMatcher.group(VersionParseHelper.VERSION_GROUP);
290-
final String distro = oldVersMatcher.group("distro");
291-
String javaVersion = oldVersMatcher.group("javaversion");
292-
if (javaVersion == null) {
293-
if (version.startsWith("19")) {
294-
javaVersion = "11"; // Fallback to JDK 11 for GraalVM 19.x
295-
} else {
296-
throw new IllegalArgumentException(
297-
"Cannot parse version from output: \n" + stringOutput);
298-
}
299-
}
300-
301-
return new Version(
302-
line,
303-
version,
304-
Runtime.Version.parse(javaVersion),
305-
isMandrel(distro) ? Distribution.MANDREL : Distribution.GRAALVM);
306-
}
307268
}
308269

309270
throw new IllegalArgumentException(
310271
"Cannot parse version from output: \n" + stringOutput);
311272
}
312273

313-
private static boolean isMandrel(String s) {
314-
return s != null && s.contains("Mandrel Distribution");
315-
}
316-
317274
public boolean isJava17() {
318275
return javaVersion.feature() == 17;
319276
}

0 commit comments

Comments
 (0)