|
11 | 11 | # ---------------------------------------------------------------------------- |
12 | 12 |
|
13 | 13 | import os |
| 14 | +import platform |
14 | 15 |
|
15 | 16 | from build_swift.build_swift.constants import MULTIROOT_DATA_FILE_PATH |
16 | 17 |
|
@@ -89,29 +90,38 @@ def run_swiftsyntax_build_script(self, target, command, additional_params=[]): |
89 | 90 | def should_build(self, host_target): |
90 | 91 | return True |
91 | 92 |
|
| 93 | + def run_swift_syntax_dev_utils(self, host_target, command, arguments=[]): |
| 94 | + swift_syntax_dev_utils = os.path.join(self.source_dir, 'SwiftSyntaxDevUtils') |
| 95 | + |
| 96 | + run_cmd = [ |
| 97 | + os.path.join(self.install_toolchain_path(host_target), "bin", "swift"), |
| 98 | + 'run', |
| 99 | + ] |
| 100 | + if self.args.verbose_build: |
| 101 | + run_cmd.append('--vv') |
| 102 | + run_cmd += [ |
| 103 | + '--package-path', swift_syntax_dev_utils, |
| 104 | + 'swift-syntax-dev-utils', |
| 105 | + command |
| 106 | + ] |
| 107 | + run_cmd += arguments |
| 108 | + if self.args.verbose_build: |
| 109 | + run_cmd.append('--verbose') |
| 110 | + |
| 111 | + env = dict(os.environ) |
| 112 | + env["SWIFTCI_USE_LOCAL_DEPS"] = "1" |
| 113 | + |
| 114 | + shell.call(run_cmd, env=env) |
| 115 | + |
92 | 116 | def build(self, host_target): |
93 | 117 | if self.args.swiftsyntax_verify_generated_files: |
94 | | - script_path = os.path.join(self.source_dir, 'SwiftSyntaxDevUtils') |
95 | | - |
96 | | - build_cmd = [ |
97 | | - os.path.join(self.install_toolchain_path(host_target), "bin", "swift"), |
98 | | - 'run', |
99 | | - ] |
100 | | - if self.args.verbose_build: |
101 | | - build_cmd.append('--vv') |
102 | | - build_cmd += [ |
103 | | - '--package-path', script_path, |
104 | | - 'swift-syntax-dev-utils', |
105 | | - 'verify-source-code', |
106 | | - '--toolchain', self.install_toolchain_path(host_target) |
107 | | - ] |
108 | | - if self.args.verbose_build: |
109 | | - build_cmd.append('--verbose') |
110 | | - |
111 | | - env = dict(os.environ) |
112 | | - env["SWIFTCI_USE_LOCAL_DEPS"] = "1" |
113 | | - |
114 | | - shell.call(build_cmd, env=env) |
| 118 | + self.run_swift_syntax_dev_utils( |
| 119 | + host_target, |
| 120 | + "verify-source-code", |
| 121 | + ['--toolchain', self.install_toolchain_path(host_target)] |
| 122 | + ) |
| 123 | + if platform.system() == 'Darwin': |
| 124 | + self.run_swift_syntax_dev_utils(host_target, "verify-documentation", []) |
115 | 125 |
|
116 | 126 | self.run_swiftsyntax_build_script(target=host_target, |
117 | 127 | command='build') |
|
0 commit comments