Skip to content

Commit

Permalink
Correctly injects version string into new native-image
Browse files Browse the repository at this point in the history
  • Loading branch information
Karm authored and zakkak committed Jun 3, 2021
1 parent 29b99ef commit 826d101
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions build.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ private static void patchNativeImageLauncher(Path nativeImage, String mandrelVer
final List<String> lines = Files.readAllLines(nativeImage);
// This is jamming two sets of parameters in between three sections of command line.
// It is fragile at best. We should probably just generate the line fresh.
final Pattern launcherPattern = Pattern.compile("(.*EnableJVMCI)(.*NativeImage.?)(.*)");
final Pattern launcherPattern = Pattern.compile("(.*EnableJVMCI)(.*)");
final Pattern relativeCp = Pattern.compile("(IFS=: read -ra relative_cp <<< \".*)(\")");
logger.debugf("mandrelVersion: %s", mandrelVersion);
for (int i = 0; i < lines.size(); i++)
Expand All @@ -256,7 +256,6 @@ private static void patchNativeImageLauncher(Path nativeImage, String mandrelVer
logger.debugf("Launcher line BEFORE: %s", lines.get(i));
logger.debugf("launcherMatcher.group(1): %s", launcherMatcher.group(1));
logger.debugf("launcherMatcher.group(2): %s", launcherMatcher.group(2));
logger.debugf("launcherMatcher.group(3): %s", launcherMatcher.group(3));
StringBuilder launcherLine = new StringBuilder(lines.get(i).length() * 2);
launcherLine.append(launcherMatcher.group(1));
launcherLine.append(" -Dorg.graalvm.version=\"" + mandrelVersion + "\"");
Expand All @@ -270,8 +269,6 @@ private static void patchNativeImageLauncher(Path nativeImage, String mandrelVer
launcherLine.append(" --upgrade-module-path ${location}/../../jvmci/graal.jar");
}
launcherLine.append(launcherMatcher.group(2));
launcherLine.append(" -J--add-exports=jdk.internal.vm.ci/jdk.vm.ci.code=jdk.internal.vm.compiler ");
launcherLine.append(launcherMatcher.group(3));
lines.set(i, launcherLine.toString());
logger.debugf("Launcher line AFTER: %s", lines.get(i));
break;
Expand Down

0 comments on commit 826d101

Please sign in to comment.