Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.java, insert version string to native-image #142

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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