Skip to content
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

Implement persistent build tracking for more intuitive behavior #1714

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ dependencies = [
"rich >= 12.6, < 14.0",
"tomli >= 2.0, < 3.0; python_version <= '3.10'",
"tomli_w >= 1.0, < 2.0",
"watchdog >= 3.0.0, < 5.0",
]

[project.optional-dependencies]
Expand Down
77 changes: 39 additions & 38 deletions src/briefcase/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,49 @@
def main():
result = 0
command = None

printer = Printer()
console = Console(printer=printer)
logger = Log(printer=printer)
try:
Command, extra_cmdline = parse_cmdline(sys.argv[1:], console=console)
command = Command(logger=logger, console=console)
options, overrides = command.parse_options(extra=extra_cmdline)
command.parse_config(
Path.cwd() / "pyproject.toml",
overrides=overrides,
)
command(**options)
except HelpText as e:
logger.info()
logger.info(str(e))
result = e.error_code
except BriefcaseWarning as w:
# The case of something that hasn't gone right, but in an
# acceptable way.
logger.warning(str(w))
result = w.error_code
except BriefcaseTestSuiteFailure as e:
# Test suite status is logged when the test is executed.
# Set the return code, but don't log anything else.
result = e.error_code
except BriefcaseError as e:
logger.error()
logger.error(str(e))
result = e.error_code
logger.capture_stacktrace()
except Exception:
logger.capture_stacktrace()
raise
except KeyboardInterrupt:
logger.warning()
logger.warning("Aborted by user.")
logger.warning()
result = -42
if logger.save_log:

with suppress(KeyboardInterrupt):
try:
Command, extra_cmdline = parse_cmdline(sys.argv[1:], console=console)
command = Command(logger=logger, console=console)
options, overrides = command.parse_options(extra=extra_cmdline)
command.parse_config(Path.cwd() / "pyproject.toml", overrides=overrides)
command(**options)
except HelpText as e:
logger.info()
logger.info(str(e))
result = e.error_code
except BriefcaseWarning as w:
# The case of something that hasn't gone right, but in an
# acceptable way.
logger.warning(str(w))
result = w.error_code
except BriefcaseTestSuiteFailure as e:
# Test suite status is logged when the test is executed.
# Set the return code, but don't log anything else.
result = e.error_code
except BriefcaseError as e:
logger.error()
logger.error(str(e))
result = e.error_code
logger.capture_stacktrace()
except Exception:
logger.capture_stacktrace()
finally:
with suppress(KeyboardInterrupt):
raise
except KeyboardInterrupt:
logger.warning()
logger.warning("Aborted by user.")
logger.warning()
result = -42
if logger.save_log:
logger.capture_stacktrace()
finally:
if command is not None:
command.tracking_save()
logger.save_log_to_file(command)

return result
Expand Down
Loading
Loading