2626from . import swiftsyntax
2727from . import xctest
2828from .. import shell
29- from .. import targets
3029
3130
3231class IndexStoreDB (product .Product ):
@@ -50,14 +49,13 @@ def should_build(self, host_target):
5049 return True
5150
5251 def build (self , host_target ):
53- run_build_script_helper ('build' , host_target , self , self . args )
52+ self . run_build_script_helper ('build' , host_target )
5453
5554 def should_test (self , host_target ):
5655 return self .args .test_indexstoredb
5756
5857 def test (self , host_target ):
59- run_build_script_helper ('test' , host_target , self , self .args ,
60- self .args .test_indexstoredb_sanitize_all )
58+ self .run_build_script_helper ('test' , host_target )
6159
6260 def should_install (self , host_target ):
6361 return False
@@ -81,64 +79,32 @@ def get_dependencies(cls):
8179 swiftpm .SwiftPM ,
8280 swiftsyntax .SwiftSyntax ]
8381
84-
85- def run_build_script_helper (action , host_target , product , args ,
86- sanitize_all = False , clean = False ):
87- script_path = os .path .join (
88- product .source_dir , 'Utilities' , 'build-script-helper.py' )
89-
90- install_destdir = product .host_install_destdir (host_target )
91- toolchain_path = product .native_toolchain_path (host_target )
92- is_release = product .is_release ()
93- configuration = 'release' if is_release else 'debug'
94- helper_cmd = [
95- script_path ,
96- action ,
97- '--package-path' , product .source_dir ,
98- '--build-path' , product .build_dir ,
99- '--configuration' , configuration ,
100- '--toolchain' , toolchain_path ,
101- '--ninja-bin' , product .toolchain .ninja ,
102- '--multiroot-data-file' , MULTIROOT_DATA_FILE_PATH ,
103- ]
104- if args .verbose_build :
105- helper_cmd .append ('--verbose' )
106-
107- if sanitize_all :
108- helper_cmd .append ('--sanitize-all' )
109- elif args .enable_asan :
110- helper_cmd .extend (['--sanitize' , 'address' ])
111- elif args .enable_ubsan :
112- helper_cmd .extend (['--sanitize' , 'undefined' ])
113- elif args .enable_tsan :
114- helper_cmd .extend (['--sanitize' , 'thread' ])
115-
116- if clean :
117- helper_cmd .append ('--clean' )
118-
119- # Pass Cross compile host info unless we're testing.
120- # It doesn't make sense to run tests of the cross compile host.
121- if product .has_cross_compile_hosts () and action != 'test' :
122- if product .is_darwin_host (host_target ):
123- if len (args .cross_compile_hosts ) != 1 :
124- raise RuntimeError ("Cross-Compiling indexstoredb to multiple " +
125- "targets is not supported" )
126- helper_cmd += ['--cross-compile-host' , args .cross_compile_hosts [0 ]]
127- elif product .is_cross_compile_target (host_target ):
128- helper_cmd .extend (['--cross-compile-host' , host_target ])
129- build_toolchain_path = install_destdir + args .install_prefix
130- resource_dir = '%s/lib/swift' % build_toolchain_path
131- helper_cmd += [
132- '--cross-compile-config' ,
133- targets .StdlibDeploymentTarget .get_target_for_name (host_target ).platform
134- .swiftpm_config (args , output_dir = build_toolchain_path ,
135- swift_toolchain = toolchain_path ,
136- resource_path = resource_dir )
137- ]
138-
139- if action == 'install' and product .product_name () == "sourcekitlsp" :
140- helper_cmd .extend ([
141- '--prefix' , install_destdir + args .install_prefix
142- ])
143-
144- shell .call (helper_cmd )
82+ def run_build_script_helper (self , action , host_target ):
83+ script_path = os .path .join (
84+ self .source_dir , 'Utilities' , 'build-script-helper.py' )
85+
86+ toolchain_path = self .native_toolchain_path (host_target )
87+ configuration = 'release' if self .is_release () else 'debug'
88+ helper_cmd = [
89+ script_path ,
90+ action ,
91+ '--package-path' , self .source_dir ,
92+ '--build-path' , self .build_dir ,
93+ '--configuration' , configuration ,
94+ '--toolchain' , toolchain_path ,
95+ '--ninja-bin' , self .toolchain .ninja ,
96+ '--multiroot-data-file' , MULTIROOT_DATA_FILE_PATH ,
97+ ]
98+ if self .args .verbose_build :
99+ helper_cmd .append ('--verbose' )
100+
101+ if self .args .test_indexstoredb_sanitize_all :
102+ helper_cmd .append ('--sanitize-all' )
103+ elif self .args .enable_asan :
104+ helper_cmd .extend (['--sanitize' , 'address' ])
105+ elif self .args .enable_ubsan :
106+ helper_cmd .extend (['--sanitize' , 'undefined' ])
107+ elif self .args .enable_tsan :
108+ helper_cmd .extend (['--sanitize' , 'thread' ])
109+
110+ shell .call (helper_cmd )
0 commit comments