@@ -49,46 +49,53 @@ def is_before_build_script_impl_product(cls):
49
49
def is_swiftpm_unified_build_product (cls ):
50
50
return True
51
51
52
- def run_swiftsyntax_build_script (self , target , additional_params = []):
53
- llvm_build_dir = os .path .join (self .build_dir , '..' , 'llvm-' + target )
54
- llvm_build_dir = os .path .realpath (llvm_build_dir )
55
-
52
+ def run_swiftsyntax_build_script (self , target , command , additional_params = []):
56
53
script_path = os .path .join (self .source_dir , 'build-script.py' )
57
54
58
55
build_cmd = [
59
56
script_path ,
57
+ command ,
60
58
'--build-dir' , self .build_dir ,
61
59
'--multiroot-data-file' , MULTIROOT_DATA_FILE_PATH ,
62
- '--toolchain' , self .install_toolchain_path (target ),
63
- '--filecheck-exec' , os .path .join (llvm_build_dir , 'bin' ,
64
- 'FileCheck' ),
60
+ '--toolchain' , self .install_toolchain_path (target )
65
61
]
66
62
67
63
if self .is_release ():
68
64
build_cmd .append ('--release' )
69
65
70
- if self .args .swiftsyntax_verify_generated_files :
71
- build_cmd .append ('--verify-generated-files' )
72
-
73
- build_cmd .extend (additional_params )
74
-
75
66
if self .args .verbose_build :
76
67
build_cmd .append ('--verbose' )
77
68
69
+ build_cmd .extend (additional_params )
70
+
78
71
shell .call (build_cmd )
79
72
80
73
def should_build (self , host_target ):
81
74
return True
82
75
83
76
def build (self , host_target ):
84
- self .run_swiftsyntax_build_script (target = host_target )
77
+ if self .args .swiftsyntax_verify_generated_files :
78
+ self .run_swiftsyntax_build_script (target = host_target ,
79
+ command = 'verify-source-code' )
80
+
81
+ self .run_swiftsyntax_build_script (target = host_target ,
82
+ command = 'build' )
85
83
86
84
def should_test (self , host_target ):
87
85
return self .args .test_swiftsyntax
88
86
89
87
def test (self , host_target ):
88
+ llvm_build_dir = os .path .join (self .build_dir , '..' , 'llvm-' + host_target )
89
+ llvm_build_dir = os .path .realpath (llvm_build_dir )
90
+
90
91
self .run_swiftsyntax_build_script (target = host_target ,
91
- additional_params = ['--test' ])
92
+ command = 'test' ,
93
+ additional_params = [
94
+ '--filecheck-exec' ,
95
+ os .path .join (llvm_build_dir ,
96
+ 'bin' ,
97
+ 'FileCheck' )
98
+ ])
92
99
93
100
def should_install (self , host_target ):
94
101
return self .args .install_swiftsyntax
0 commit comments