Skip to content

Commit

Permalink
[GR-18965] Fix native-image-agent=build mode for Java 11.
Browse files Browse the repository at this point in the history
PullRequest: graal/4664
  • Loading branch information
olpaw committed Oct 21, 2019
2 parents 75baacf + 545c3ab commit 0def59c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
public class NativeImage {

private static final String DEFAULT_GENERATOR_CLASS_NAME = "com.oracle.svm.hosted.NativeImageGeneratorRunner";
private static final String DEFAULT_GENERATOR_9PLUS_SUFFIX = "$JDK9Plus";

static final boolean IS_AOT = Boolean.getBoolean("com.oracle.graalvm.isaot");

Expand Down Expand Up @@ -1189,7 +1190,11 @@ public static void build(BuildConfiguration config) {
}

public static void agentBuild(Path javaHome, Path workDir, List<String> buildArgs) {
performBuild(new DefaultBuildConfiguration(DEFAULT_GENERATOR_CLASS_NAME, javaHome, workDir, buildArgs), NativeImage::new);
String generatorClassName = DEFAULT_GENERATOR_CLASS_NAME;
if (JavaVersionUtil.JAVA_SPEC > 8) {
generatorClassName += DEFAULT_GENERATOR_9PLUS_SUFFIX;
}
performBuild(new DefaultBuildConfiguration(generatorClassName, javaHome, workDir, buildArgs), NativeImage::new);
}

public static Map<Path, List<String>> extractEmbeddedImageArgs(Path workDir, String[] imageClasspath) {
Expand Down Expand Up @@ -1665,7 +1670,7 @@ public static void main(String[] args) {
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.internal.vm.compiler", false);
ModuleSupport.exportAndOpenAllPackagesToUnnamed("com.oracle.graal.graal_enterprise", true);
}
NativeImage.main(args, DEFAULT_GENERATOR_CLASS_NAME + "$JDK9Plus");
NativeImage.main(args, DEFAULT_GENERATOR_CLASS_NAME + DEFAULT_GENERATOR_9PLUS_SUFFIX);
}
}
}

0 comments on commit 0def59c

Please sign in to comment.