Skip to content

Commit c87f7e3

Browse files
committed
[GR-63253] Unchained standalones fixes
PullRequest: graal/20722
2 parents 277902c + 84df9cb commit c87f7e3

File tree

4 files changed

+76
-16
lines changed

4 files changed

+76
-16
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This is a daily development build of the Oracle product and is offered to you
2+
as part of the development and testing process. Oracle does not recommend
3+
bundling this build with your products or otherwise using for any production
4+
purpose. This build is offered to and received by you solely under the GraalVM
5+
Free Terms and Conditions (GFTC), and is not governed by any other license
6+
between you and Oracle, including without limitation the Oracle Master
7+
Agreement. The features and functionality of the product are subject to change
8+
at any time and the existence of any features or functionality in this build
9+
should not be relied upon in making purchasing decisions. The existence of
10+
particular features or functionality in this build is not a commitment to
11+
deliver any hardware, software or other material, or code, or functionality,
12+
and you should not rely on the future availability of any feature or
13+
functionality in the product. The development, release, and timing of any
14+
features or functionality for this product remain at the sole discretion of
15+
Oracle. In the event you decide to provide any input to Oracle regarding the
16+
product, you acknowledge that Oracle may use that input for any purpose,
17+
including but not limited to incorporation or implementation of the input in
18+
any Oracle product or service, and the display, marketing, sublicensing and
19+
distribution of the input as incorporated or embedded in any product or service
20+
distributed or offered by Oracle.

sdk/mx.sdk/mx_sdk_vm_ng.py

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,16 @@ def _get_dyn_attribute(dep, attr_name, default):
126126
raise mx.abort(f"Could not resolve {attr_name} '{attr}' in {suite.extensions.__file__}", context=dep)
127127
return func(), attr
128128

129-
def _is_enterprise():
130-
return mx.suite('graal-enterprise', fatalIfMissing=False) or mx.suite('truffle-enterprise', fatalIfMissing=False) or mx.suite('substratevm-enterprise', fatalIfMissing=False)
131129

132-
def _is_nativeimage_ee():
130+
def _has_suite(name):
131+
return mx.suite(name, fatalIfMissing=False)
132+
133+
# Whether any of truffle-enterprise, graal-enterprise or substratevm-enterprise are imported.
134+
def uses_enterprise_sources():
135+
# Technically testing for truffle-enterprise might be enough currently, but unclear if graal-enterprise will always depend on truffle-enterprise.
136+
return _has_suite('truffle-enterprise') or _has_suite('graal-enterprise') or _has_suite('substratevm-enterprise')
137+
138+
def is_nativeimage_ee():
133139
global _is_nativeimage_ee_cache
134140
if _is_nativeimage_ee_cache is None:
135141
if not _external_bootstrap_graalvm:
@@ -138,13 +144,18 @@ def _is_nativeimage_ee():
138144
_is_nativeimage_ee_cache = exists(join(_external_bootstrap_graalvm, 'lib', 'svm', 'builder', 'svm-enterprise.jar'))
139145
return _is_nativeimage_ee_cache
140146

147+
# Whether the produced standalone uses anything enterprise, either from source or prebuilt (i.e., a boostrap Oracle GraalVM)
148+
def is_enterprise():
149+
return uses_enterprise_sources() or is_nativeimage_ee()
150+
141151
class StandaloneLicenses(mx.Project):
142152
def __init__(self, suite, name, deps, workingSets, theLicense=None, **kw_args):
143153
self.community_license_file = _require(kw_args, 'community_license_file', suite, name)
144154
self.community_3rd_party_license_file = _require(kw_args, 'community_3rd_party_license_file', suite, name)
145155

146-
self.enterprise = _is_enterprise()
147-
if self.enterprise:
156+
self.uses_enterprise_sources = uses_enterprise_sources()
157+
self.enterprise = is_enterprise()
158+
if self.uses_enterprise_sources:
148159
deps.append('lium:LICENSE_INFORMATION_USER_MANUAL')
149160
super().__init__(suite, name, subDir=None, srcDirs=[], deps=deps, workingSets=workingSets, d=suite.dir, theLicense=theLicense, **kw_args)
150161

@@ -156,12 +167,17 @@ def getArchivableResults(self, use_relpath=True, single=False):
156167
raise ValueError('single not supported')
157168

158169
if self.enterprise:
159-
truffle_enterprise = mx.suite('truffle-enterprise', fatalIfMissing=True, context=self)
160-
vm_enterprise_dir = join(dirname(truffle_enterprise.dir), 'vm-enterprise')
161-
yield join(vm_enterprise_dir, 'GraalVM_GFTC_License.txt'), 'LICENSE.txt'
162-
yield from mx.distribution('lium:LICENSE_INFORMATION_USER_MANUAL').getArchivableResults(use_relpath, single=True)
163-
if not mx.suite('sdk').is_release():
164-
yield join(vm_enterprise_dir, 'DISCLAIMER_FOR_SNAPSHOT_ARTIFACTS.txt'), 'DISCLAIMER.txt'
170+
if not _suite.is_release():
171+
yield join(_suite.mxDir, 'DISCLAIMER_FOR_GFTC_SNAPSHOT_ARTIFACTS.txt'), 'DISCLAIMER.txt'
172+
if self.uses_enterprise_sources:
173+
lium_suite = mx.suite('lium', fatalIfMissing=True, context=self)
174+
vm_enterprise_dir = join(dirname(lium_suite.dir), 'vm-enterprise')
175+
yield join(vm_enterprise_dir, 'GraalVM_GFTC_License.txt'), 'LICENSE.txt'
176+
yield from mx.distribution('lium:LICENSE_INFORMATION_USER_MANUAL').getArchivableResults(use_relpath, single=True)
177+
else:
178+
# If the only enterprise input is a bootstrap Oracle GraalVM then copy the license from there
179+
yield join(_external_bootstrap_graalvm, 'LICENSE.txt'), 'LICENSE.txt'
180+
yield join(_external_bootstrap_graalvm, 'license-information-user-manual.zip'), 'license-information-user-manual.zip'
165181
else:
166182
yield join(self.suite.dir, self.community_license_file), 'LICENSE.txt'
167183
yield join(self.suite.dir, self.community_3rd_party_license_file), '3rd_party_licenses.txt'
@@ -182,14 +198,19 @@ def needsBuild(self, newestInput):
182198
else:
183199
contents = None
184200
if contents != self.witness_contents():
185-
return True, 'CE<=>EE'
201+
return True, f"{contents} => {self.witness_contents()}"
186202
return False, 'Files are already on disk'
187203

188204
def witness_file(self):
189205
return join(self.subject.get_output_root(), 'witness')
190206

191207
def witness_contents(self):
192-
return 'ee' if self.subject.enterprise else 'ce'
208+
if self.subject.uses_enterprise_sources:
209+
return 'ee sources'
210+
elif self.subject.enterprise:
211+
return _external_bootstrap_graalvm
212+
else:
213+
return 'ce'
193214

194215
def build(self):
195216
witness_file = self.witness_file()
@@ -338,7 +359,7 @@ def name_suffix(self):
338359

339360
def get_build_args(self):
340361
extra_build_args = ['--shared']
341-
if _is_nativeimage_ee():
362+
if is_nativeimage_ee():
342363
# PGO is supported
343364
extra_build_args += mx_sdk_vm_impl.svm_experimental_options(['-H:+ProfilingEnableProfileDumpHooks'])
344365
return super().get_build_args() + extra_build_args
@@ -400,7 +421,7 @@ def get_build_args(self):
400421
canonical_name = self.subject.base_file_name()
401422
profiles = mx_sdk_vm_impl._image_profiles(canonical_name)
402423
if profiles:
403-
if not _is_nativeimage_ee():
424+
if not is_nativeimage_ee():
404425
raise mx.abort("Image profiles can not be used if PGO is not supported.")
405426
basenames = [basename(p) for p in profiles]
406427
if len(set(basenames)) != len(profiles):
@@ -756,6 +777,10 @@ def archived_deps(self):
756777
def isJDKDependent(self):
757778
return False
758779

780+
# Needed when somesuite._output_root_includes_config() == False
781+
def get_output_root(self):
782+
return join(self.get_output_base(), self.name)
783+
759784

760785
class JavaHomeBuildTask(mx.BuildTask):
761786
subject: JavaHomeDependency
@@ -997,7 +1022,7 @@ def __init__(self, suite, name=None, deps=None, excludedLibs=None, platformDepen
9971022
path_substitutions.register_no_arg('graalvm_os', mx_sdk_vm_impl.get_graalvm_os())
9981023
string_substitutions = mx_subst.SubstitutionEngine(path_substitutions)
9991024

1000-
if _is_enterprise():
1025+
if is_enterprise():
10011026
dir_name = enterprise_dir_name or f'{enterprise_archive_name}-<version>-<graalvm_os>-<arch>'
10021027
dist_name = 'STANDALONE_' + enterprise_archive_name.upper().replace('-', '_')
10031028
else:

tools/mx.tools/mx_tools.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,13 @@ def apply(self, config):
198198
# in turn allows us to dynamically open fields/methods to reflection.
199199
vmArgs = vmArgs + ['--add-exports=java.base/jdk.internal.module=ALL-UNNAMED']
200200
vmArgs = vmArgs + ['--add-modules=ALL-MODULE-PATH']
201+
# The tools unittests use internals
202+
mainClassArgs.extend(['-JUnitOpenPackages', 'com.oracle.truffle.tools.chromeinspector/*=ALL-UNNAMED'])
203+
mainClassArgs.extend(['-JUnitOpenPackages', 'com.oracle.truffle.tools.coverage/*=ALL-UNNAMED'])
204+
mainClassArgs.extend(['-JUnitOpenPackages', 'com.oracle.truffle.tools.dap/*=ALL-UNNAMED'])
205+
mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.tools.insight/*=ALL-UNNAMED'])
206+
mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.tools.insight.heap/*=ALL-UNNAMED'])
207+
mainClassArgs.extend(['-JUnitOpenPackages', 'org.graalvm.tools.lsp/*=ALL-UNNAMED'])
201208
return (vmArgs, mainClass, mainClassArgs)
202209

203210
mx_unittest.register_unittest_config(ToolsUnittestConfig())

tools/mx.tools/suite.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@
370370
"org.graalvm.polyglot",
371371
],
372372
},
373+
"useModulePath" : True,
373374
"dependencies": ["com.oracle.truffle.tools.chromeinspector"],
374375
"distDependencies" : [
375376
"truffle:TRUFFLE_API",
@@ -431,6 +432,7 @@
431432
"org.graalvm.collections",
432433
],
433434
},
435+
"useModulePath" : True,
434436
"dependencies": [
435437
"org.graalvm.tools.insight",
436438
"com.oracle.truffle.tools.agentscript"
@@ -467,6 +469,7 @@
467469
"org.graalvm.polyglot",
468470
],
469471
},
472+
"useModulePath" : True,
470473
"dependencies": [
471474
"org.graalvm.tools.insight.heap"
472475
],
@@ -538,6 +541,7 @@
538541
"org.graalvm.polyglot",
539542
],
540543
},
544+
"useModulePath" : True,
541545
"dependencies": [
542546
"com.oracle.truffle.tools.profiler",
543547
],
@@ -597,6 +601,7 @@
597601
"org.graalvm.polyglot",
598602
],
599603
},
604+
"useModulePath" : True,
600605
"dependencies": [
601606
"com.oracle.truffle.tools.coverage",
602607
],
@@ -658,6 +663,7 @@
658663
"org.graalvm.polyglot",
659664
],
660665
},
666+
"useModulePath" : True,
661667
"dependencies": [
662668
"com.oracle.truffle.tools.dap",
663669
],
@@ -724,6 +730,7 @@
724730
"subDir": "src",
725731
# This distribution defines a module.
726732
"moduleName" : "org.graalvm.tools.api.lsp",
733+
"useModulePath" : True,
727734
"dependencies": ["org.graalvm.tools.api.lsp"],
728735
"distDependencies" : [
729736
"truffle:TRUFFLE_API",
@@ -746,6 +753,7 @@
746753
"org.graalvm.truffle",
747754
],
748755
},
756+
"useModulePath" : True,
749757
"dependencies": [
750758
"org.graalvm.tools.api.lsp",
751759
"org.graalvm.tools.lsp"

0 commit comments

Comments
 (0)