@@ -126,10 +126,16 @@ def _get_dyn_attribute(dep, attr_name, default):
126
126
raise mx .abort (f"Could not resolve { attr_name } '{ attr } ' in { suite .extensions .__file__ } " , context = dep )
127
127
return func (), attr
128
128
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 )
131
129
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 ():
133
139
global _is_nativeimage_ee_cache
134
140
if _is_nativeimage_ee_cache is None :
135
141
if not _external_bootstrap_graalvm :
@@ -138,13 +144,18 @@ def _is_nativeimage_ee():
138
144
_is_nativeimage_ee_cache = exists (join (_external_bootstrap_graalvm , 'lib' , 'svm' , 'builder' , 'svm-enterprise.jar' ))
139
145
return _is_nativeimage_ee_cache
140
146
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
+
141
151
class StandaloneLicenses (mx .Project ):
142
152
def __init__ (self , suite , name , deps , workingSets , theLicense = None , ** kw_args ):
143
153
self .community_license_file = _require (kw_args , 'community_license_file' , suite , name )
144
154
self .community_3rd_party_license_file = _require (kw_args , 'community_3rd_party_license_file' , suite , name )
145
155
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 :
148
159
deps .append ('lium:LICENSE_INFORMATION_USER_MANUAL' )
149
160
super ().__init__ (suite , name , subDir = None , srcDirs = [], deps = deps , workingSets = workingSets , d = suite .dir , theLicense = theLicense , ** kw_args )
150
161
@@ -156,12 +167,17 @@ def getArchivableResults(self, use_relpath=True, single=False):
156
167
raise ValueError ('single not supported' )
157
168
158
169
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'
165
181
else :
166
182
yield join (self .suite .dir , self .community_license_file ), 'LICENSE.txt'
167
183
yield join (self .suite .dir , self .community_3rd_party_license_file ), '3rd_party_licenses.txt'
@@ -182,14 +198,19 @@ def needsBuild(self, newestInput):
182
198
else :
183
199
contents = None
184
200
if contents != self .witness_contents ():
185
- return True , 'CE<=>EE'
201
+ return True , f" { contents } => { self . witness_contents () } "
186
202
return False , 'Files are already on disk'
187
203
188
204
def witness_file (self ):
189
205
return join (self .subject .get_output_root (), 'witness' )
190
206
191
207
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'
193
214
194
215
def build (self ):
195
216
witness_file = self .witness_file ()
@@ -338,7 +359,7 @@ def name_suffix(self):
338
359
339
360
def get_build_args (self ):
340
361
extra_build_args = ['--shared' ]
341
- if _is_nativeimage_ee ():
362
+ if is_nativeimage_ee ():
342
363
# PGO is supported
343
364
extra_build_args += mx_sdk_vm_impl .svm_experimental_options (['-H:+ProfilingEnableProfileDumpHooks' ])
344
365
return super ().get_build_args () + extra_build_args
@@ -400,7 +421,7 @@ def get_build_args(self):
400
421
canonical_name = self .subject .base_file_name ()
401
422
profiles = mx_sdk_vm_impl ._image_profiles (canonical_name )
402
423
if profiles :
403
- if not _is_nativeimage_ee ():
424
+ if not is_nativeimage_ee ():
404
425
raise mx .abort ("Image profiles can not be used if PGO is not supported." )
405
426
basenames = [basename (p ) for p in profiles ]
406
427
if len (set (basenames )) != len (profiles ):
@@ -756,6 +777,10 @@ def archived_deps(self):
756
777
def isJDKDependent (self ):
757
778
return False
758
779
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
+
759
784
760
785
class JavaHomeBuildTask (mx .BuildTask ):
761
786
subject : JavaHomeDependency
@@ -997,7 +1022,7 @@ def __init__(self, suite, name=None, deps=None, excludedLibs=None, platformDepen
997
1022
path_substitutions .register_no_arg ('graalvm_os' , mx_sdk_vm_impl .get_graalvm_os ())
998
1023
string_substitutions = mx_subst .SubstitutionEngine (path_substitutions )
999
1024
1000
- if _is_enterprise ():
1025
+ if is_enterprise ():
1001
1026
dir_name = enterprise_dir_name or f'{ enterprise_archive_name } -<version>-<graalvm_os>-<arch>'
1002
1027
dist_name = 'STANDALONE_' + enterprise_archive_name .upper ().replace ('-' , '_' )
1003
1028
else :
0 commit comments