Skip to content

Commit 064efad

Browse files
authored
Merge pull request #67777 from ahoppen/ahoppen/format-in-swift
[build] Adjustment to reflect that we re-wrote swift-syntax/format.py in Swift
2 parents 789774b + dc689ab commit 064efad

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

utils/swift_build_support/swift_build_support/products/swiftformat.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,37 @@ def should_build(self, host_target):
8686
def build(self, host_target):
8787
self.run_build_script_helper('build', host_target)
8888
if self.args.swiftsyntax_lint:
89-
self.lint_swiftsyntax()
89+
self.lint_swiftsyntax(host_target)
9090
if self.args.sourcekitlsp_lint:
9191
self.lint_sourcekitlsp()
9292

93-
def lint_swiftsyntax(self):
93+
def lint_swiftsyntax(self, host_target):
94+
swift_exec = os.path.join(
95+
self.install_toolchain_path(host_target),
96+
'bin',
97+
'swift'
98+
)
99+
swift_syntax_dev_utils_dir = os.path.join(
100+
os.path.dirname(self.source_dir),
101+
'swift-syntax',
102+
'SwiftSyntaxDevUtils'
103+
)
104+
swift_format_exec = os.path.join(
105+
self.build_dir,
106+
self.configuration(),
107+
'swift-format'
108+
)
94109
linting_cmd = [
95-
os.path.join(os.path.dirname(self.source_dir), 'swift-syntax', 'format.py'),
110+
swift_exec,
111+
'run',
112+
'--package-path', swift_syntax_dev_utils_dir,
113+
'swift-syntax-dev-utils',
114+
'format',
115+
'--verbose',
96116
'--lint',
97-
'--swift-format', os.path.join(self.build_dir, self.configuration(),
98-
'swift-format'),
117+
'--swift-format', swift_format_exec
99118
]
100-
shell.call(linting_cmd)
119+
shell.call(linting_cmd, env={'SWIFTCI_USE_LOCAL_DEPS': '1'})
101120

102121
def lint_sourcekitlsp(self):
103122
linting_cmd = [

0 commit comments

Comments
 (0)