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

[GR-37582] Default to running image-builder on module path. #4468

Merged
merged 41 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
75db584
Default to running image-builder on module path
olpaw Mar 31, 2022
f25c9ed
Consolidate ModuleSupport methods
olpaw Apr 4, 2022
ee8bb44
Remove unqualified exports of org.graalvm.nativeimage.builder packages
olpaw Apr 4, 2022
a2a4ed1
Only use native-image API in mx cinterfacetutorial
olpaw Apr 4, 2022
d74c506
Fold ModuleSupportBase into ModuleSupport
olpaw Apr 5, 2022
dfefd00
Fix mx clinittest image-builder module access
olpaw Apr 5, 2022
db9f155
Remove unused dependency
olpaw Apr 5, 2022
161a42d
Open up builder to allow whitebox testing in mx native-unittest
olpaw Apr 5, 2022
9752bf5
Make TruffleTCKFeature#findTCKTests compatible with builder on module…
olpaw Apr 6, 2022
b5338df
Remove obsolete property from --macro:truffle
olpaw Apr 6, 2022
5f005d1
Ensure truffle image builds use builder on classpath (for now)
olpaw Apr 6, 2022
e0cbc76
Ensure all use of -p is reported as error for truffle image building
olpaw Apr 6, 2022
aa8d982
Style fix
olpaw Apr 6, 2022
a2ee12a
Cleanup JfrEventFeature module access
olpaw May 2, 2022
5d1ad1a
Allow ModuleSupport.isModulePathBuild() to be used in image
olpaw May 3, 2022
e28b8e9
Make org.graalvm.nativeimage.base exports qualified
olpaw May 3, 2022
b7f9c07
Opening up org.graalvm.nativeimage.builder packages in JUnitFeature.a…
olpaw May 3, 2022
5a6a738
Allow com.oracle.svm.test code to use com.oracle.svm.util
olpaw May 3, 2022
3fba91c
Add missing access of org.graalvm.compiler.nodes.graphbuilderconf fro…
olpaw May 4, 2022
910283b
Fix building of LibGraal with builder on module-path
olpaw May 4, 2022
e9632f8
Make gu buildable with builder on module-path
olpaw May 4, 2022
7ea35b9
Style fix
olpaw May 4, 2022
e91f1ed
Fix clinittest for Windows
olpaw May 4, 2022
38488e6
Run `Run Truffle API tests on SVM` with builder-on-cp
olpaw May 4, 2022
697ad4f
Fix -H:CompilerBackend=llvm with builder on module-path
olpaw May 5, 2022
f6e55af
Fix TruffleTCKFeature.findTCKTests() for MX_BUILD_EXPLODED=true
olpaw May 5, 2022
c9ddf55
Ensure LibGraalFeature is allowed to instantiate OptionDescriptor sub…
olpaw May 5, 2022
fd98b9a
Run run LLVMUnittests with builder-on-cp
olpaw May 9, 2022
b3704e5
Exporting org.graalvm.nativeimage.llvm to LibGraalFeature needs to be…
olpaw May 9, 2022
bbfd140
Fix implementation of ClassLoaderSupport.isNativeImageClassLoader
olpaw May 11, 2022
a791ac5
Fix micronaut benchmarking with builder on module-path
olpaw May 16, 2022
0dc299c
Fix quarkus benchmarking with builder on module-path
olpaw May 16, 2022
59a2a96
Make APIOptionHandler builder-on-module-path safe
olpaw May 16, 2022
81d0c99
Fix quarkus tika-wrk benchmarking with builder on module-path
olpaw May 18, 2022
dd65f0c
Fix ScalaAnalysisPlugin with builder on module-path
olpaw May 18, 2022
822e0e9
Fix _native_unittest --force-builder-on-cp
olpaw May 24, 2022
257affe
Make NativeImageSystemClassLoader able to handle having module classl…
olpaw Jun 1, 2022
c53bc18
Remove package-private access to NativeImageClassLoaderSupport.classP…
olpaw Jun 7, 2022
b15a72f
Add GR-37582 completion to CHANGELOG
olpaw Jun 7, 2022
c31bc8b
Make ModuleSupport.isModulePathBuild private
olpaw Jun 8, 2022
bfb082e
Throw ModuleSupportError if module not found and accessPackagesToClas…
olpaw Jun 8, 2022
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
2 changes: 1 addition & 1 deletion compiler/mx.compiler/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@
"org.graalvm.compiler.core.common to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.objectfile",
"org.graalvm.compiler.debug to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.objectfile",
"org.graalvm.compiler.hotspot to jdk.internal.vm.compiler.management",
"org.graalvm.compiler.nodes.graphbuilderconf to org.graalvm.nativeimage.driver",
"org.graalvm.compiler.nodes.graphbuilderconf to org.graalvm.nativeimage.driver,org.graalvm.nativeimage.librarysupport",
"org.graalvm.compiler.options to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.junitsupport",
"org.graalvm.compiler.phases.common to org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.configure",
"org.graalvm.compiler.serviceprovider to jdk.internal.vm.compiler.management,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.diagnostics",
Expand Down
10 changes: 10 additions & 0 deletions java-benchmarks/mx.java-benchmarks/mx_java_benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ def extra_image_build_argument(self, benchmark, args):
'-H:EnableURLProtocols=http',
'-H:NativeLinkerOption=-no-pie',
'-H:-UseServiceLoaderFeature',
'--add-exports=org.graalvm.nativeimage.base/com.oracle.svm.util=ALL-UNNAMED',
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.configure=ALL-UNNAMED',
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.localization=ALL-UNNAMED',
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED',
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.threadlocal=ALL-UNNAMED',
'-H:+StackTrace'] + super(BaseQuarkusBenchmarkSuite, self).extra_image_build_argument(benchmark, args)


Expand Down Expand Up @@ -460,6 +465,11 @@ def build_assertions(self, benchmark, is_gate):
# This method overrides NativeImageMixin.build_assertions
return [] # We are skipping build assertions due to some failed asserts while building Micronaut apps.

def extra_image_build_argument(self, benchmark, args):
return [
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED',
] + super(BaseMicronautBenchmarkSuite, self).extra_image_build_argument(benchmark, args)

def default_stages(self):
return ['instrument-image', 'instrument-run', 'image', 'run']

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Args = --features=com.oracle.svm.thirdparty.jline.JLine3Feature \
Args = --add-exports=org.graalvm.nativeimage.base/com.oracle.svm.util=ALL-UNNAMED \
--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED \
--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jni=ALL-UNNAMED \
--features=com.oracle.svm.thirdparty.jline.JLine3Feature \
--initialize-at-build-time=org.graalvm.launcher \
-H:JNIConfigurationResources=${.}/launcher.jniconfig \
--add-modules=java.scripting \
Expand Down
1 change: 1 addition & 0 deletions substratevm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This changelog summarizes major changes to GraalVM Native Image.
* (GR-37606) Add support for URLs and short descriptions to `Feature`. This info is shown as part of the build output.
* (GR-38965) Heap dumps are now supported in Community Edition.
* (GR-38951) Add `-XX:+DumpHeapAndExit` option to dump the initial heap of a native executable.
* (GR-37582) Run image-builder on module-path per default. Opt-out with env setting `USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false`.

## Version 22.1.0
* (GR-36568) Add "Quick build" mode, enabled through option `-Ob`, for quicker native image builds.
Expand Down
2 changes: 1 addition & 1 deletion substratevm/mx.substratevm/macro-junitcp.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Args = -H:Features=com.oracle.svm.junit.JUnitFeature \
-H:Class=com.oracle.svm.junit.SVMJUnitRunner \
-H:TestFile=${*} \
--initialize-at-build-time=org.junit,com.oracle.mxtool.junit \
[email protected]
[email protected]
45 changes: 33 additions & 12 deletions substratevm/mx.substratevm/mx_substratevm.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def image_demo_task(extra_image_args=None, flightrecorder=True):


def truffle_unittest_task(quickbuild=False):
truffle_build_args = ['--build-args', '--macro:truffle',
truffle_build_args = ['--force-builder-on-cp', '--build-args', '--macro:truffle',
'-H:MaxRuntimeCompileMethods=5000',
'-H:+TruffleCheckBlackListedMethods']
if quickbuild:
Expand Down Expand Up @@ -407,7 +407,7 @@ def svm_gate_body(args, tasks):
with native_image_context(IMAGE_ASSERTION_FLAGS) as native_image:
testlib = mx_subst.path_substitutions.substitute('-Dnative.test.lib=<path:truffle:TRUFFLE_TEST_NATIVE>/<lib:nativetest>')
isolation_testlib = mx_subst.path_substitutions.substitute('-Dnative.isolation.test.lib=<path:truffle:TRUFFLE_TEST_NATIVE>/<lib:isolationtest>')
native_unittest_args = ['com.oracle.truffle.nfi.test', '--build-args', '--language:nfi',
native_unittest_args = ['com.oracle.truffle.nfi.test', '--force-builder-on-cp', '--build-args', '--language:nfi',
'-H:MaxRuntimeCompileMethods=2000',
'-H:+TruffleCheckBlackListedMethods',
'--run-args', testlib, isolation_testlib, '--very-verbose', '--enable-timing']
Expand All @@ -418,7 +418,7 @@ def svm_gate_body(args, tasks):
with native_image_context(IMAGE_ASSERTION_FLAGS) as native_image:
testlib = mx_subst.path_substitutions.substitute('-Dnative.test.lib=<path:truffle:TRUFFLE_TEST_NATIVE>/<lib:nativetest>')
isolation_testlib = mx_subst.path_substitutions.substitute('-Dnative.isolation.test.lib=<path:truffle:TRUFFLE_TEST_NATIVE>/<lib:isolationtest>')
native_unittest_args = ['com.oracle.truffle.nfi.test', '--build-args', '--language:nfi',
native_unittest_args = ['com.oracle.truffle.nfi.test', '--force-builder-on-cp', '--build-args', '--language:nfi',
'-H:MaxRuntimeCompileMethods=2000',
'-H:+TruffleCheckBlackListedMethods'] + DEVMODE_FLAGS + [
'--run-args', testlib, isolation_testlib, '--very-verbose', '--enable-timing']
Expand Down Expand Up @@ -484,7 +484,7 @@ def native_unittests_task(extra_build_args=None):
if mx.is_windows():
mx_unittest.add_global_ignore_glob('com.oracle.svm.test.SecurityServiceTest')

native_unittest(['--builder-on-modulepath', '--build-args', _native_unittest_features] + additional_build_args)
native_unittest(['--build-args', _native_unittest_features] + additional_build_args)


def conditional_config_task(native_image):
Expand Down Expand Up @@ -564,7 +564,7 @@ def javac_image_command(javac_path):
)


def _native_junit(native_image, unittest_args, build_args=None, run_args=None, blacklist=None, whitelist=None, preserve_image=False, builder_on_modulepath=False):
def _native_junit(native_image, unittest_args, build_args=None, run_args=None, blacklist=None, whitelist=None, preserve_image=False, force_builder_on_cp=False):
build_args = build_args or []
javaProperties = {}
for dist in suite.dists:
Expand All @@ -591,8 +591,14 @@ def dummy_harness(test_deps, vm_launcher, vm_args):
with open(unittest_file, 'r') as f:
mx.log('Building junit image for matching: ' + ' '.join(l.rstrip() for l in f))
extra_image_args = mx.get_runtime_jvm_args(unittest_deps, jdk=mx_compiler.jdk, exclude_names=['substratevm:LIBRARY_SUPPORT'])
macro_junit = '--macro:junit' + ('' if builder_on_modulepath else 'cp')
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + [macro_junit + '=' + unittest_file, '-H:Path=' + junit_test_dir])
macro_junit = '--macro:junit'
if force_builder_on_cp:
macro_junit += 'cp'
custom_env = os.environ.copy()
custom_env['USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM'] = 'false'
else:
custom_env = None
unittest_image = native_image(['-ea', '-esa'] + build_args + extra_image_args + [macro_junit + '=' + unittest_file, '-H:Path=' + junit_test_dir], env=custom_env)
image_pattern_replacement = unittest_image + ".exe" if mx.is_windows() else unittest_image
run_args = [arg.replace('${unittest.image}', image_pattern_replacement) for arg in run_args]
mx.log('Running: ' + ' '.join(map(pipes.quote, [unittest_image] + run_args)))
Expand All @@ -617,14 +623,14 @@ def unmask(args):

def _native_unittest(native_image, cmdline_args):
parser = ArgumentParser(prog='mx native-unittest', description='Run unittests as native image.')
all_args = ['--build-args', '--run-args', '--blacklist', '--whitelist', '-p', '--preserve-image', '--builder-on-modulepath']
all_args = ['--build-args', '--run-args', '--blacklist', '--whitelist', '-p', '--preserve-image', '--force-builder-on-cp']
cmdline_args = [_mask(arg, all_args) for arg in cmdline_args]
parser.add_argument(all_args[0], metavar='ARG', nargs='*', default=[])
parser.add_argument(all_args[1], metavar='ARG', nargs='*', default=[])
parser.add_argument('--blacklist', help='run all testcases not specified in <file>', metavar='<file>')
parser.add_argument('--whitelist', help='run testcases specified in <file> only', metavar='<file>')
parser.add_argument('-p', '--preserve-image', help='do not delete the generated native image', action='store_true')
parser.add_argument('--builder-on-modulepath', help='perform image build with builder on module-path', action='store_true')
parser.add_argument('--force-builder-on-cp', help='force image builder to run on classpath', action='store_true')
parser.add_argument('unittest_args', metavar='TEST_ARG', nargs='*')
pargs = parser.parse_args(cmdline_args)

Expand All @@ -645,8 +651,7 @@ def _native_unittest(native_image, cmdline_args):
mx.log('warning: could not read blacklist: ' + blacklist)

unittest_args = unmask(pargs.unittest_args) if unmask(pargs.unittest_args) else ['com.oracle.svm.test', 'com.oracle.svm.configure.test']
builder_on_modulepath = pargs.builder_on_modulepath
_native_junit(native_image, unittest_args, unmask(pargs.build_args), unmask(pargs.run_args), blacklist, whitelist, pargs.preserve_image, builder_on_modulepath)
_native_junit(native_image, unittest_args, unmask(pargs.build_args), unmask(pargs.run_args), blacklist, whitelist, pargs.preserve_image, pargs.force_builder_on_cp)


def jvm_unittest(args):
Expand Down Expand Up @@ -728,7 +733,7 @@ def _cinterfacetutorial(native_image, args=None):
mkpath(build_dir)

# Build the shared library from Java code
native_image(['--shared', '-H:Path=' + build_dir, '-H:Name=libcinterfacetutorial',
native_image(['--shared', '-H:Path=' + build_dir, '-H:Name=libcinterfacetutorial', '-Dcom.oracle.svm.tutorial.headerfile=' + join(c_source_dir, 'mydata.h'),
'-H:CLibraryPath=' + tutorial_proj.dir, '-cp', tutorial_proj.output_dir()] + args)

# Build the C executable
Expand Down Expand Up @@ -1090,6 +1095,22 @@ def _native_image_launcher_extra_jvm_args():
'compiler:GRAAL_MANAGEMENT_LIBGRAAL']

libgraal_build_args = [
## Pass via JVM args opening up of packages needed for image builder early on
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.hotspot=ALL-UNNAMED',
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.options=ALL-UNNAMED',
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.truffle.common.hotspot=ALL-UNNAMED',
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.truffle.common=ALL-UNNAMED',
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.jniutils=ALL-UNNAMED',
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.libgraal.jni.annotation=ALL-UNNAMED',
'-J--add-exports=jdk.internal.vm.compiler/org.graalvm.libgraal.jni=ALL-UNNAMED',
'-J--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.annotate=ALL-UNNAMED',
'-J--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.option=ALL-UNNAMED',
## Packages used after option-processing can be opened by the builder (`-J`-prefix not needed)
# LibGraalFeature implements com.oracle.svm.core.graal.GraalFeature (needed to be able to instantiate LibGraalFeature)
'--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.graal=ALL-UNNAMED',
# Make ModuleSupport accessible to do the remaining opening-up in LibGraalFeature constructor
'--add-exports=org.graalvm.nativeimage.base/com.oracle.svm.util=ALL-UNNAMED',

'--initialize-at-build-time=org.graalvm.compiler,org.graalvm.libgraal,com.oracle.truffle',
'-H:-UseServiceLoaderFeature',
'-H:+AllowFoldMethods',
Expand Down
13 changes: 3 additions & 10 deletions substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@
"com.oracle.svm.tutorial" : {
"subDir": "src",
"sourceDirs" : ["src"],
"dependencies" : ["com.oracle.svm.core"],
"dependencies" : ["sdk:GRAAL_SDK"],
"checkstyle" : "com.oracle.svm.hosted",
"javaCompliance": "11+",
"annotationProcessors" : [
Expand Down Expand Up @@ -1126,13 +1126,6 @@
"moduleInfo" : {
"name" : "org.graalvm.nativeimage.builder",
"exports" : [
"com.oracle.svm.core.configure", # even Feature impls on class-path need access, thus unqualified
"com.oracle.svm.core.jdk", # Uses of com.oracle.svm.core.jdk.StackTraceUtils
"com.oracle.svm.core.snippets", # Uses of com.oracle.svm.core.snippets.KnownIntrinsics
"com.oracle.svm.core", # Uses of com.oracle.svm.core.TypeResult
"com.oracle.svm.core.util", # Uses of com.oracle.svm.core.util.VMError
"com.oracle.svm.core.jni", # Uses of com.oracle.svm.core.jni.JNIRuntimeAccess
"com.oracle.svm.core.jfr", # Uses of com.oracle.svm.core.jfr.HasJfrSupport
"com.oracle.svm.hosted to java.base",
"com.oracle.svm.hosted.agent to java.instrument",
"com.oracle.svm.truffle.api to org.graalvm.truffle",
Expand Down Expand Up @@ -1467,8 +1460,8 @@
"moduleInfo" : {
"name" : "org.graalvm.nativeimage.base",
"exports" : [
"com.oracle.svm.util",
"com.oracle.svm.common.option",
"com.oracle.svm.util to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.llvm,org.graalvm.nativeimage.agent.jvmtibase,org.graalvm.nativeimage.agent.tracing,org.graalvm.nativeimage.agent.diagnostics,org.graalvm.nativeimage.junitsupport,com.oracle.svm.svm_enterprise",
"com.oracle.svm.common.option to org.graalvm.nativeimage.pointsto,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.driver",
],
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class SignatureUtilFeature implements Feature {
@Override
public void afterRegistration(AfterRegistrationAccess access) {
if (!access.getApplicationClassPath().isEmpty()) {
ModuleSupport.exportAndOpenPackageToClass("jdk.internal.vm.ci", "jdk.vm.ci.meta", false, SignatureUtil.class);
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, SignatureUtil.class, false, "jdk.internal.vm.ci", "jdk.vm.ci.meta");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import com.oracle.svm.core.graal.llvm.lowering.LLVMLoadExceptionObjectLowering;
import com.oracle.svm.core.graal.llvm.lowering.SubstrateLLVMLoweringProvider;
import com.oracle.svm.core.graal.llvm.replacements.LLVMGraphBuilderPlugins;
import com.oracle.svm.core.graal.llvm.replacements.LLVMIntrinsicNode;
import com.oracle.svm.core.graal.llvm.runtime.LLVMExceptionUnwind;
import com.oracle.svm.core.graal.llvm.util.LLVMOptions;
import com.oracle.svm.core.graal.llvm.util.LLVMToolchain;
Expand Down Expand Up @@ -90,7 +89,8 @@ public boolean isInConfiguration(IsInConfigurationAccess access) {
@Override
public void afterRegistration(AfterRegistrationAccess access) {
if (ModuleSupport.modulePathBuild) {
ModuleSupport.openModuleByClass(LLVMIntrinsicNode.class, NodeClass.class);
ModuleSupport.accessModuleByClass(ModuleSupport.Access.EXPORT, NodeClass.class, LLVMGraphBuilderPlugins.class);
ModuleSupport.accessModuleByClass(ModuleSupport.Access.EXPORT, NodeClass.class, SubstrateLLVMLoweringProvider.class);
}

ImageSingletons.add(SubstrateBackendFactory.class, new SubstrateBackendFactory() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public List<Class<? extends Feature>> getRequiredFeatures() {

@Override
public void afterRegistration(AfterRegistrationAccess access) {
ModuleSupport.exportAndOpenAllPackagesToUnnamed("jdk.jfr", false);
ModuleSupport.exportAndOpenAllPackagesToUnnamed("java.base", false);
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, null, false, "jdk.jfr");
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.OPEN, null, false, "java.base");

// Initialize some parts of JFR/JFC at image build time.
List<Configuration> knownConfigurations = JFC.getConfigurations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import com.oracle.svm.driver.NativeImage.ArgumentQueue;
import com.oracle.svm.hosted.FeatureImpl;
import com.oracle.svm.hosted.option.HostedOptionParser;
import com.oracle.svm.util.ModuleSupport;
import com.oracle.svm.util.ReflectionUtil;
import com.oracle.svm.util.ReflectionUtil.ReflectionUtilError;

Expand Down Expand Up @@ -474,6 +475,12 @@ final class APIOptionSupport {
@AutomaticFeature
final class APIOptionFeature implements Feature {

@Override
public void afterRegistration(AfterRegistrationAccess access) {
ModuleSupport.accessPackagesToClass(ModuleSupport.Access.EXPORT, APIOptionFeature.class, true,
"jdk.internal.vm.compiler", "org.graalvm.compiler.options");
}

@Override
public void duringSetup(DuringSetupAccess access) {
FeatureImpl.DuringSetupAccessImpl accessImpl = (FeatureImpl.DuringSetupAccessImpl) access;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ private void applyEnabled(MacroOption.EnabledOption enabledOption, String argume
}

BuildConfiguration config = nativeImage.config;

String propertyName = "BuilderOnClasspath";
String propertyValue = enabledOption.getProperty(config, propertyName);
if (propertyValue != null) {
boolean modulePathBuild = !Boolean.valueOf(propertyValue);
String imageBuilderModeEnforcer = enabledOption.getOption().toString();
if (config.imageBuilderModeEnforcer != null && modulePathBuild != config.modulePathBuild) {
NativeImage.showError(String.format("Conflicting %s property values. %s (%b) vs %s (%b)", propertyName,
imageBuilderModeEnforcer, modulePathBuild, config.imageBuilderModeEnforcer, config.modulePathBuild));
}
config.imageBuilderModeEnforcer = imageBuilderModeEnforcer;
config.modulePathBuild = modulePathBuild;
}

enabledOption.forEachPropertyValue(config, "ImageBuilderClasspath", entry -> nativeImage.addImageBuilderClasspath(ClasspathUtils.stringToClasspath(entry)), PATH_SEPARATOR_REGEX);

boolean explicitImageModulePath = enabledOption.forEachPropertyValue(
Expand Down
Loading