public class NativeImageGeneratorRunner extends Object implements ImageBuildTask
Modifier and Type | Class and Description |
---|---|
static class |
NativeImageGeneratorRunner.JDK9Plus
Command line entry point when running on JDK9+.
|
Constructor and Description |
---|
NativeImageGeneratorRunner() |
Modifier and Type | Method and Description |
---|---|
int |
build(String[] args,
ImageClassLoader imageClassLoader)
Main function for remote image building which is invoked on every image building request sent
to the server.
|
static String[] |
extractImagePathEntries(List<String> arguments,
String pathPrefix) |
static int |
extractWatchPID(List<String> arguments) |
static String |
getJavaVersion() |
static ImageClassLoader |
installNativeImageClassLoader(String[] classpath,
String[] modulepath)
Installs a class loader hierarchy that resolves classes and resources available in
classpath and modulepath . |
void |
interruptBuild()
Requests interruption of the image build.
|
static boolean |
isValidJavaVersion()
Unless the check should be ignored, check that I am running on JDK-8.
|
static void |
main(String[] args) |
static void |
reportUserError(String msg)
Function for reporting all fatal errors in SVM.
|
static void |
reportUserError(Throwable e,
org.graalvm.compiler.options.OptionValues parsedHostedOptions)
Function for reporting all fatal errors in SVM.
|
static void |
uninstallNativeImageClassLoader() |
static boolean |
verifyValidJavaVersionAndPlatform() |
public static void main(String[] args)
public static void uninstallNativeImageClassLoader()
public static ImageClassLoader installNativeImageClassLoader(String[] classpath, String[] modulepath)
classpath
and modulepath
. The parent for the installed ClassLoader
is
the default system class loader (jdk.internal.loader.ClassLoaders.AppClassLoader and
sun.misc.Launcher.AppClassLoader for JDK11, 8 respectively).
We use a custom system class loader NativeImageSystemClassLoader
that delegates to
the ClassLoader
that NativeImageClassLoaderSupport
creates, thus allowing the
resolution of classes in classpath
and modulepath
via system class loader.classpath
- for the application and image should be built for.modulepath
- for the application and image should be built for (only for Java >= 11).ClassLoader
for image building
via AbstractNativeImageClassLoaderSupport.getClassLoader()
.public static String[] extractImagePathEntries(List<String> arguments, String pathPrefix)
public static boolean isValidJavaVersion()
public static boolean verifyValidJavaVersionAndPlatform()
public static String getJavaVersion()
public static void reportUserError(String msg)
msg
- error message that is printed.public static void reportUserError(Throwable e, org.graalvm.compiler.options.OptionValues parsedHostedOptions)
e
- error message that is printed.parsedHostedOptions
- public int build(String[] args, ImageClassLoader imageClassLoader)
ImageBuildTask
build
finishes, the static state of the JDK
and NativeImageBuildServer
must not have pointers to classes loaded by
compilationClassLoader
.build
in interface ImageBuildTask
args
- arguments passed with the request to the SVM image builderimageClassLoader
- the classloader used for this image building taskNativeImageBuildServer
public void interruptBuild()
ImageBuildTask
interruptBuild
in interface ImageBuildTask