Skip to content

Commit

Permalink
Fixes version parsing for WARNING situations
Browse files Browse the repository at this point in the history
(cherry picked from commit ff3824b)
  • Loading branch information
Karm committed Aug 19, 2024
1 parent 14d5910 commit 3817366
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions build.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -43,6 +40,9 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

public class build
{
static final Logger logger = LogManager.getLogger(build.class);
Expand Down Expand Up @@ -337,8 +337,21 @@ else if (archiveName.endsWith("zip") && !IS_WINDOWS)

private static String getMandrelVersion(FileSystem fs, OperatingSystem os, Path mandrelRepo)
{
String mandrelVersion = os.exec(Mx.mandrelVersion(fs.mxHome(), fs.mandrelRepo()), true).get(0);

final Pattern startsWithNumber = Pattern.compile("^\\d.*");
String mandrelVersion = null;
final List<String> o = os.exec(Mx.mandrelVersion(fs.mxHome(), fs.mandrelRepo()), true);
for (String s : o)
{
logger.info("mx's graalvm-version output: " + s);
if (mandrelVersion == null && startsWithNumber.matcher(s).matches())
{
mandrelVersion = s;
}
}
if (mandrelVersion == null)
{
throw new RuntimeException("Could not determine Mandrel version from mx graalvm-version output");
}
if (mandrelVersion.endsWith("-dev"))
{
final Tasks.Exec command = Tasks.Exec.of(Arrays.asList("git", "rev-parse", "--short", "HEAD"), mandrelRepo);
Expand Down

0 comments on commit 3817366

Please sign in to comment.