@@ -49,46 +49,55 @@ 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 = []):
52
+ def run_swiftsyntax_build_script (self , target , command , additional_params = []):
53
53
llvm_build_dir = os .path .join (self .build_dir , '..' , 'llvm-' + target )
54
54
llvm_build_dir = os .path .realpath (llvm_build_dir )
55
55
56
56
script_path = os .path .join (self .source_dir , 'build-script.py' )
57
57
58
58
build_cmd = [
59
59
script_path ,
60
+ ]
61
+
62
+ # Verbose need to come before the command, as it is on the root parser
63
+ if self .args .verbose_build :
64
+ build_cmd .append ('--verbose' )
65
+
66
+ build_cmd .extend ([
67
+ command ,
60
68
'--build-dir' , self .build_dir ,
61
69
'--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' ),
65
- ]
70
+ '--toolchain' , self .install_toolchain_path (target )
71
+ ])
66
72
67
73
if self .is_release ():
68
74
build_cmd .append ('--release' )
69
75
70
- if self .args .swiftsyntax_verify_generated_files :
71
- build_cmd .append ('--verify-generated-files' )
72
-
73
76
build_cmd .extend (additional_params )
74
77
75
- if self .args .verbose_build :
76
- build_cmd .append ('--verbose' )
77
-
78
78
shell .call (build_cmd )
79
79
80
80
def should_build (self , host_target ):
81
81
return True
82
82
83
83
def build (self , host_target ):
84
- self .run_swiftsyntax_build_script (target = host_target )
84
+ if self .args .swiftsyntax_verify_generated_files :
85
+ self .run_swiftsyntax_build_script (target = host_target ,
86
+ command = 'verify-source-code' )
87
+
88
+ self .run_swiftsyntax_build_script (target = host_target ,
89
+ command = 'build' )
85
90
86
91
def should_test (self , host_target ):
87
92
return self .args .test_swiftsyntax
88
93
89
- def test (self , host_target ):
94
+ def test (self , host_target ):
90
95
self .run_swiftsyntax_build_script (target = host_target ,
91
- additional_params = ['--test' ])
96
+ command = 'test' ,
97
+ additional_params = [
98
+ '--filecheck-exec' , os .path .join (llvm_build_dir , 'bin' ,
99
+ 'FileCheck' )
100
+ ])
92
101
93
102
def should_install (self , host_target ):
94
103
return self .args .install_swiftsyntax
0 commit comments