Skip to content

Commit 2cdc637

Browse files
committed
[SwiftSyntax] Clean build script
swiftlang/swift-syntax#458
1 parent ed88700 commit 2cdc637

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

utils/swift_build_support/swift_build_support/products/swiftsyntax.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,23 @@ def is_before_build_script_impl_product(cls):
4949
def is_swiftpm_unified_build_product(cls):
5050
return True
5151

52-
def run_swiftsyntax_build_script(self, target, additional_params=[]):
52+
def run_swiftsyntax_build_script(self, target, command, additional_params=[]):
5353
llvm_build_dir = os.path.join(self.build_dir, '..', 'llvm-' + target)
5454
llvm_build_dir = os.path.realpath(llvm_build_dir)
5555

5656
script_path = os.path.join(self.source_dir, 'build-script.py')
5757

5858
build_cmd = [
5959
script_path,
60+
command,
6061
'--build-dir', self.build_dir,
6162
'--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'),
63+
'--toolchain', self.install_toolchain_path(target)
6564
]
6665

6766
if self.is_release():
6867
build_cmd.append('--release')
6968

70-
if self.args.swiftsyntax_verify_generated_files:
71-
build_cmd.append('--verify-generated-files')
72-
7369
build_cmd.extend(additional_params)
7470

7571
if self.args.verbose_build:
@@ -81,14 +77,23 @@ def should_build(self, host_target):
8177
return True
8278

8379
def build(self, host_target):
84-
self.run_swiftsyntax_build_script(target=host_target)
80+
if self.args.swiftsyntax_verify_generated_files:
81+
self.run_swiftsyntax_build_script(target=host_target,
82+
command='verify-source-code')
83+
84+
self.run_swiftsyntax_build_script(target=host_target,
85+
command='build')
8586

8687
def should_test(self, host_target):
8788
return self.args.test_swiftsyntax
8889

89-
def test(self, host_target):
90+
def test(self, host_target):
9091
self.run_swiftsyntax_build_script(target=host_target,
91-
additional_params=['--test'])
92+
command='test',
93+
additional_params=[
94+
'--filecheck-exec', os.path.join(llvm_build_dir, 'bin',
95+
'FileCheck')
96+
])
9297

9398
def should_install(self, host_target):
9499
return self.args.install_swiftsyntax

0 commit comments

Comments
 (0)