Skip to content

Commit 4b8e41b

Browse files
authored
Merge pull request #70779 from ahoppen/ahoppen/validate-swiftsyntax-documentation
[swift-syntax] Verify that swift-syntax documentation builds without warnings
2 parents 060d822 + 48d2797 commit 4b8e41b

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed

utils/swift_build_support/swift_build_support/products/swiftsyntax.py

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# ----------------------------------------------------------------------------
1212

1313
import os
14+
import platform
1415

1516
from build_swift.build_swift.constants import MULTIROOT_DATA_FILE_PATH
1617

@@ -89,29 +90,38 @@ def run_swiftsyntax_build_script(self, target, command, additional_params=[]):
8990
def should_build(self, host_target):
9091
return True
9192

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+
92116
def build(self, host_target):
93117
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", [])
115125

116126
self.run_swiftsyntax_build_script(target=host_target,
117127
command='build')

0 commit comments

Comments
 (0)