@@ -1193,6 +1193,19 @@ def mx_post_parse_cmd_line(opts):
1193
1193
for dist in suite .dists :
1194
1194
if dist .isJARDistribution ():
1195
1195
dist .set_archiveparticipant (GraalArchiveParticipant (dist , isTest = dist .name .endswith ('_TEST' )))
1196
+ # Compilation of module-info.java classes need upgrade-module path arguments to
1197
+ # when javac is invoked. This is in particular needed when the base JDK includes no
1198
+ # JMODs.
1199
+ if opts .no_jlinking :
1200
+ all_jar_dists = set ()
1201
+ for p in suite .projects_recursive ():
1202
+ if p .isJavaProject ():
1203
+ jd = p .get_declaring_module_distribution ()
1204
+ if jd :
1205
+ all_jar_dists .add (jd )
1206
+ for d in all_jar_dists :
1207
+ d .add_module_info_compilation_participant (NoJlinkModuleInfoCompilationParticipant (d , "jdk.graal.compiler" ).__process__ )
1208
+
1196
1209
1197
1210
def native_image_context_run (func , func_args = None , config = None , build_if_missing = False ):
1198
1211
func_args = [] if func_args is None else func_args
@@ -1877,6 +1890,33 @@ def checkLine(line, marker, init_kind, msg, wrongly_initialized_lines):
1877
1890
1878
1891
native_image_context_run (build_and_test_clinittest_image , args )
1879
1892
1893
+ class NoJlinkModuleInfoCompilationParticipant :
1894
+
1895
+ def __init__ (self , dist , module_name ):
1896
+ self .dist = dist
1897
+ self .module_name = module_name
1898
+
1899
+ # Upgrade module path for compilation of module-info.java files when not using jmods from the JDK
1900
+ def __process__ (self , module_desc ):
1901
+ """
1902
+ :param module_desc: The JavaModuleDescriptor for this distribution
1903
+ :rtype: list of strings with extra javac arguments
1904
+ """
1905
+ def safe_path_arg (p ):
1906
+ r"""
1907
+ Return `p` with all `\` characters replaced with `\\`, all spaces replaced
1908
+ with `\ ` and the result enclosed in double quotes.
1909
+ """
1910
+ return '"' + p .replace ('\\ ' , '\\ \\ ' ).replace (' ' , '\\ ' ) + '"'
1911
+ graal_mod = None
1912
+ for m in module_desc .modulepath :
1913
+ if m .name == self .module_name :
1914
+ graal_mod = m
1915
+ break
1916
+ if graal_mod :
1917
+ return [ '--upgrade-module-path=' + safe_path_arg (graal_mod .jarpath ) ]
1918
+ return []
1919
+
1880
1920
1881
1921
class SubstrateJvmFuncsFallbacksBuilder (mx .Project ):
1882
1922
def __init__ (self , suite , name , deps , workingSets , theLicense , ** kwArgs ):
0 commit comments