1
1
#
2
- # Copyright (c) 2025, 2025, Oracle and/or its affiliates. All rights reserved.
2
+ # Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3
3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
#
5
5
# The Universal Permissive License (UPL), Version 1.0
44
44
import sys
45
45
from abc import ABCMeta , abstractmethod
46
46
from os import listdir , linesep
47
- from os .path import join , exists , isfile , basename , relpath , isdir , isabs , dirname
47
+ from os .path import join , exists , isfile , basename , relpath , isdir , isabs , dirname , normpath
48
48
from typing import Tuple
49
49
50
50
import mx
@@ -381,6 +381,9 @@ def __init__(self, args, project: NativeImageProject):
381
381
max_parallelism = 12
382
382
super ().__init__ (project , args , min (max_parallelism , mx .cpu_count ()))
383
383
384
+ def newestOutput (self ):
385
+ return mx .TimeStampFile .newest ([_path for _path , _ in self .subject .getArchivableResults ()])
386
+
384
387
def get_build_args (self ):
385
388
experimental_build_args = [
386
389
'-H:+GenerateBuildArtifactsFile' , # generate 'build-artifacts.json'
@@ -931,14 +934,57 @@ def witness_contents(self):
931
934
return f"roots: { ', ' .join (self .subject .root_components )} \n ignored: { ', ' .join (self .subject .ignore_components )} "
932
935
933
936
937
+ def _make_windows_link (link_target ):
938
+ link_template_name = join (_suite .mxDir , 'vm' , 'exe_link_template.cmd' )
939
+ with open (link_template_name , 'r' ) as template :
940
+ _template_subst = mx_subst .SubstitutionEngine (mx_subst .string_substitutions )
941
+ _template_subst .register_no_arg ('target' , normpath (link_target ))
942
+ return _template_subst .substitute (template .read ())
943
+
944
+
945
+ class ToolchainToolDistribution (mx .LayoutDirDistribution ):
946
+ def __init__ (self , suite , name = None , deps = None , excludedLibs = None , platformDependent = True , theLicense = None , defaultBuild = True , ** kw_args ):
947
+ self .tool_project = _require (kw_args , 'tool_project' , suite , name )
948
+ self .tool_links = _require (kw_args , 'tool_links' , suite , name )
949
+
950
+ layout = {
951
+ './' : [{
952
+ "source_type" : "dependency" ,
953
+ "dependency" : self .tool_project ,
954
+ }]
955
+ }
956
+
957
+ super ().__init__ (suite , name = name , deps = [], layout = layout , path = None , theLicense = theLicense , platformDependent = True , defaultBuild = defaultBuild )
958
+
959
+ def resolveDeps (self ):
960
+ self .tool_project = mx .project (self .tool_project )
961
+ _ , main_tool_name = next (self .tool_project .getArchivableResults (single = True ))
962
+
963
+ def _add_link (name , target ):
964
+ if mx .is_windows ():
965
+ # ignore indirect symlinks on windows and link everything directly to the main tool
966
+ # otherwise we lose the original program name
967
+ self .layout [f'./{ name } .cmd' ] = f'string:{ _make_windows_link (main_tool_name )} '
968
+ else :
969
+ self .layout [f'./{ name } ' ] = f'link:{ target } '
970
+
971
+ for tool in self .tool_links :
972
+ _add_link (tool , main_tool_name )
973
+ alt_names = self .tool_links [tool ]
974
+ for alt_name in alt_names :
975
+ _add_link (alt_name , tool )
976
+
977
+ super ().resolveDeps ()
978
+
979
+
934
980
if mx .is_windows ():
935
981
DeliverableArchiveSuper = mx .LayoutZIPDistribution
936
982
else :
937
983
DeliverableArchiveSuper = mx .LayoutTARDistribution
938
984
939
985
940
986
class DeliverableStandaloneArchive (DeliverableArchiveSuper ):
941
- def __init__ (self , suite , name = None , deps = None , excludedLibs = None , platformDependent = True , theLicense = None , ** kw_args ):
987
+ def __init__ (self , suite , name = None , deps = None , excludedLibs = None , platformDependent = True , theLicense = None , defaultBuild = True , ** kw_args ):
942
988
standalone_dir_dist = _require (kw_args , 'standalone_dist' , suite , name )
943
989
community_archive_name = _require (kw_args , 'community_archive_name' , suite , name )
944
990
enterprise_archive_name = _require (kw_args , 'enterprise_archive_name' , suite , name )
@@ -959,11 +1005,16 @@ def __init__(self, suite, name=None, deps=None, excludedLibs=None, platformDepen
959
1005
dist_name = 'STANDALONE_' + community_archive_name .upper ().replace ('-' , '_' )
960
1006
961
1007
layout = {
962
- f'{ dir_name } /' : f'dependency:{ standalone_dir_dist } /*'
1008
+ f'{ dir_name } /' : {
1009
+ "source_type" : "dependency" ,
1010
+ "dependency" : standalone_dir_dist ,
1011
+ "path" : "*" ,
1012
+ "dereference" : "never" ,
1013
+ }
963
1014
}
964
1015
self .standalone_dir_dist = standalone_dir_dist
965
1016
maven = { 'groupId' : 'org.graalvm' , 'tag' : 'standalone' }
966
- super ().__init__ (suite , name = dist_name , deps = [], layout = layout , path = None , theLicense = theLicense , platformDependent = True , path_substitutions = path_substitutions , string_substitutions = string_substitutions , maven = maven )
1017
+ super ().__init__ (suite , name = dist_name , deps = [], layout = layout , path = None , theLicense = theLicense , platformDependent = True , path_substitutions = path_substitutions , string_substitutions = string_substitutions , maven = maven , defaultBuild = defaultBuild )
967
1018
self .buildDependencies .append (standalone_dir_dist )
968
1019
969
1020
def resolveDeps (self ):
0 commit comments