Index: tools_webrtc/android/build_aar.py |
diff --git a/tools_webrtc/android/build_aar.py b/tools_webrtc/android/build_aar.py |
index 54272e979e446c25de831aa36f24624ed335976f..ff62049a903b23e62504805f651ae88ea651db04 100755 |
--- a/tools_webrtc/android/build_aar.py |
+++ b/tools_webrtc/android/build_aar.py |
@@ -46,6 +46,8 @@ TARGETS = [ |
def _ParseArgs(): |
parser = argparse.ArgumentParser(description='libwebrtc.aar generator.') |
+ parser.add_argument('--build-dir', |
+ help='Build dir. By default will create and use temporary dir.') |
parser.add_argument('--output', default='libwebrtc.aar', |
help='Output file of the script.') |
parser.add_argument('--arch', default=DEFAULT_ARCHS, nargs='*', |
@@ -162,18 +164,19 @@ def main(): |
args = _ParseArgs() |
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO) |
- tmp_dir = tempfile.mkdtemp() |
+ build_dir = args.build_dir if args.build_dir else tempfile.mkdtemp() |
for arch in args.arch: |
- Build(tmp_dir, arch, args.use_goma, args.extra_gn_args) |
+ Build(build_dir, arch, args.use_goma, args.extra_gn_args) |
with zipfile.ZipFile(args.output, 'w') as aar_file: |
# Architecture doesn't matter here, arbitrarily using the first one. |
- CollectCommon(aar_file, tmp_dir, args.arch[0]) |
+ CollectCommon(aar_file, build_dir, args.arch[0]) |
for arch in args.arch: |
- Collect(aar_file, tmp_dir, arch) |
+ Collect(aar_file, build_dir, arch) |
- shutil.rmtree(tmp_dir, True) |
+ if not args.build_dir: |
+ shutil.rmtree(build_dir, True) |
if __name__ == '__main__': |