Adding build option to upload parser
The default behavior is building with mm after upgrading and before
uploading to Gerrit. Using --no_build flag with upload parser can bypass
it.
Test: TreeHugger
Change-Id: I72e84c7c871d2dcb657ca87ea018c1c6d7519ebd
diff --git a/README.md b/README.md
index 345de8a..a6bf28f 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,12 @@
tools/external_updater/updater.sh update --keep_local_changes ${LIBNAME}
```
+Update a library without building:
+
+```shell
+tools/external_updater/updater.sh update --no_build ${LIBNAME}
+```
+
LIBNAME can be the path to a library under external/, e.g. kotlinc, or
python/cpython3.
diff --git a/external_updater.py b/external_updater.py
index d147d13..fe03390 100644
--- a/external_updater.py
+++ b/external_updater.py
@@ -116,6 +116,11 @@
fileutils.write_metadata(full_path, updated_metadata, args.keep_date)
git_utils.add_file(full_path, 'METADATA')
+ if args.build:
+ if not updater_utils.build(full_path):
+ print("Build failed. Aborting upload.")
+ return
+
if args.stop_after_merge:
return
@@ -310,6 +315,10 @@
update_parser.add_argument('--skip_post_update',
action='store_true',
help='Skip post_update script')
+ update_parser.add_argument('--no_build',
+ action='store_false',
+ dest='build',
+ help='Skip building'),
update_parser.add_argument('--remote_name',
default='aosp',
required=False,
diff --git a/updater_utils.py b/updater_utils.py
index 3960d76..b263dcb 100644
--- a/updater_utils.py
+++ b/updater_utils.py
@@ -128,3 +128,9 @@
if not latest:
raise ValueError('No matching version.')
return latest
+
+
+def build(proj_path: Path) -> None:
+ cmd = ['build/soong/soong_ui.bash', "--build-mode", "--modules-in-a-dir-no-deps", f"--dir={str(proj_path)}"]
+ print('Building...')
+ return subprocess.run(cmd, check=True, text=True)