Skip to content

Commit 0eb2ca4

Browse files
committed
Drop polyglot.jar and truffle-api.jar from native-image launcher
1 parent 6917e64 commit 0eb2ca4

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

sdk/mx.sdk/mx_sdk_vm_impl.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def svm_experimental_options(experimental_options):
125125
dir_name='polyglot',
126126
launcher_configs=[mx_sdk_vm.LauncherConfig(
127127
destination='bin/<exe:polyglot>',
128-
jar_distributions=['sdk:LAUNCHER_COMMON'],
128+
jar_distributions=['sdk:LAUNCHER_COMMON', 'truffle:TRUFFLE_API'],
129129
main_class='org.graalvm.launcher.PolyglotLauncher',
130130
build_args=[
131131
'--features=org.graalvm.launcher.PolyglotLauncherFeature',
@@ -2183,13 +2183,9 @@ def _get_extra_jvm_args():
21832183
extra_jvm_args = mx.list_to_cmd_line(image_config.extra_jvm_args)
21842184
if not _jlink_libraries():
21852185
if mx.is_windows():
2186-
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"',
2187-
r'--add-modules org.graalvm.polyglot',
2188-
r'--module-path "%location%\..\..\truffle\truffle-api.jar:%location%\..\..\jvmci\polyglot.jar"'])
2186+
extra_jvm_args = ' '.join([extra_jvm_args, r'--upgrade-module-path "%location%\..\..\jvmci\graal.jar"'])
21892187
else:
2190-
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"',
2191-
'--add-modules org.graalvm.polyglot',
2192-
'--module-path "${location}/../../truffle/truffle-api.jar:${location}/../../jvmci/polyglot.jar"'])
2188+
extra_jvm_args = ' '.join([extra_jvm_args, '--upgrade-module-path "${location}/../../jvmci/graal.jar"'])
21932189
return extra_jvm_args
21942190

21952191
def _get_option_vars():

substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,25 +570,35 @@ public List<Path> getBuilderModulePath() {
570570
}
571571

572572
private List<Path> createTruffleBuilderModulePath() {
573-
List<Path> jars = getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-api", "truffle-runtime", "truffle-enterprise");
573+
Path libTruffleDir = rootDir.resolve(Paths.get("lib", "truffle"));
574+
List<Path> jars = getJars(libTruffleDir, "truffle-api", "truffle-runtime", "truffle-enterprise");
574575
if (!jars.isEmpty()) {
575576
/*
576577
* If Truffle is installed as part of the JDK we always add the builder modules of
577578
* Truffle to the builder module path. This is legacy support and should in the
578579
* future no longer be needed.
579580
*/
580-
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
581+
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
581582
Path builderPath = rootDir.resolve(Paths.get("lib", "truffle", "builder"));
582583
if (Files.exists(builderPath)) {
583584
jars.addAll(getJars(builderPath, "truffle-runtime-svm", "truffle-enterprise-svm"));
585+
if (libJvmciDir != null) {
586+
// truffle-runtime-svm depends on polyglot, which is not part of non-jlinked
587+
// JDKs
588+
jars.addAll(getJars(libJvmciDir, "polyglot"));
589+
}
590+
}
591+
if (libJvmciDir != null) {
592+
// truffle-runtime depends on polyglot, which is not part of non-jlinked JDKs
593+
jars.addAll(getJars(libTruffleDir, "jniutils"));
584594
}
585595
}
586596
/*
587597
* Non-Jlinked JDKs don't have truffle-compiler as part of the JDK, however the native
588598
* image builder still needs it
589599
*/
590600
if (libJvmciDir != null) {
591-
jars.addAll(getJars(rootDir.resolve(Paths.get("lib", "truffle")), "truffle-compiler"));
601+
jars.addAll(getJars(libTruffleDir, "truffle-compiler"));
592602
}
593603

594604
return jars;

0 commit comments

Comments
 (0)