Skip to content

[DNM] Format test #79350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 4 additions & 25 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,6 @@ def tar(source, destination):
shell.call(args + [source], stderr=shell.DEVNULL)


def process_system_exit(e: SystemExit) -> int:
# According to Python's documents, `SystemExit.code` is the exit status
# or error message that is passed to the constructor. (Defaults to None.)
#
# This means that `SystemExit.code` is either `None`, an `int` object or
# a `string` object of error message.
if e.code is None:
# Fallback to 1 if there is no error code but a `SystemExit`.
return 1
try:
numeric_code = int(e.code)
return numeric_code
except ValueError:
# Fallback to 1 if it is an error message and print that message.
print(e)
return 1
finally:
# Fallback to 1 and do nothing, since there is only ValueError as
# expected exception.
return 1


# -----------------------------------------------------------------------------
# Argument Validation

Expand Down Expand Up @@ -825,11 +803,12 @@ def main():
if __name__ == "__main__":
try:
exit_code = main()
log_analyzer()
except SystemExit as e:
error_code = process_system_exit(e)
os._exit(error_code)
raise e
except KeyboardInterrupt:
sys.exit(1)
finally:
except:
log_analyzer()
raise
sys.exit(exit_code)
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,16 @@ def lint_swiftsyntax(self, host_target):
shell.call(linting_cmd, env={'SWIFTCI_USE_LOCAL_DEPS': '1'})

def lint_sourcekitlsp(self):
format_path = os.path.join(self.build_dir, self.configuration(), 'swift-format')
lsp_path = os.path.join(os.path.dirname(self.source_dir), 'sourcekit-lsp')
shell.call([format_path, '-h'])
linting_cmd = [
os.path.join(self.build_dir, self.configuration(), 'swift-format'),
format_path,
'lint',
'--parallel',
'--strict',
'--recursive',
os.path.join(os.path.dirname(self.source_dir), 'sourcekit-lsp'),
lsp_path,
]
shell.call(linting_cmd)

Expand Down