chore: Update vendoring should error if a subprocess has an issue.

This commit is contained in:
Mark Banner 2024-05-15 13:23:13 +01:00
Родитель 50cad1defa
Коммит 574be82135
1 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -4,6 +4,7 @@ import argparse
import pathlib
import re
import subprocess
import sys
APP_SERVICES_DEPENDENCY_RE = re.compile(
r'([\w-]+).*{\s*git\s*=\s*"https://github.com/mozilla/application-services"'
@ -15,8 +16,8 @@ def main():
moz_central_root = pathlib.Path(args.moz_central_dir)
app_services_rev = get_app_services_rev()
update_cargo_toml(moz_central_root / "Cargo.toml", app_services_rev)
subprocess.run(["./mach", "vendor", "rust"], cwd=moz_central_root)
subprocess.run(["./mach", "uniffi", "generate"], cwd=moz_central_root)
run_process(["./mach", "vendor", "rust"], cwd=moz_central_root)
run_process(["./mach", "uniffi", "generate"], cwd=moz_central_root)
print("The vendoring was successful")
print(" - If you saw a warning saying `There are 2 different versions of crate X`, then "
@ -26,6 +27,12 @@ def main():
print()
print("Details here: https://github.com/mozilla/application-services/blob/main/docs/howtos/vendoring-into-mozilla-central.md")
def run_process(command, cwd):
result = subprocess.run(command, cwd=cwd)
if result.returncode != 0:
print("Vendoring failed, please see above errors", file=sys.stderr)
sys.exit(1)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("moz_central_dir")