commit 9051ed9ecaeba59280a1968902b9055e39a6ce57
parent 33b427a4d065f1af36621d2f1db45c683523ea60
Author: Michael Froman <mfroman@mozilla.com>
Date: Thu, 9 Oct 2025 22:05:36 -0500
Bug 1993083 - Vendor libwebrtc from 41150c58a1
Upstream commit: https://webrtc.googlesource.com/src/+/41150c58a100924188c24c6138aab44012c82c1a
tools: Ensure --build-dir is under SRC_DIR in tools_webrtc/android/build_aar.py
After migrating the script to use Siso, the script doesn't work if the
build dir isn't under SRC_DIR.
https://webrtc-review.googlesource.com/c/src/+/391480/comments/f8acc07e_f5d582a1
This CL stops creating a temp dir and adds a check to show a user
friendly error.
Bug: chromium:412968361
Change-Id: I6cf6287289e48778037b7e24f32dac6fca581884
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/398001
Auto-Submit: Junji Watanabe <jwata@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Christoffer Dewerin <jansson@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#45198}
Diffstat:
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor
@@ -1,4 +1,4 @@
# ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc
-libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-10T03:04:13.739878+00:00.
+libwebrtc updated from /home/mfroman/mozilla/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-10-10T03:05:27.148272+00:00.
# base of lastest vendoring
-b360bf4a95
+41150c58a1
diff --git a/third_party/libwebrtc/tools_webrtc/android/build_aar.py b/third_party/libwebrtc/tools_webrtc/android/build_aar.py
@@ -26,14 +26,14 @@ structure generated by this script looks like this:
import argparse
import logging
import os
-import shutil
+import pathlib
import subprocess
import sys
-import tempfile
import zipfile
SCRIPT_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
+DEFAULT_BUILD_DIR = os.path.join(SRC_DIR, 'out_aar')
DEFAULT_ARCHS = ['armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64']
NEEDED_SO_FILES = ['libjingle_peerconnection_so.so']
JAR_FILE = 'lib.java/sdk/android/libwebrtc.jar'
@@ -55,6 +55,7 @@ def _ParseArgs():
parser.add_argument(
'--build-dir',
type=os.path.abspath,
+ default=DEFAULT_BUILD_DIR,
help='Build dir. By default will create and use temporary dir.')
parser.add_argument('--output',
default='libwebrtc.aar',
@@ -230,18 +231,17 @@ def GenerateLicenses(output_dir, build_dir, archs):
builder.generate_license_text(output_dir)
-def BuildAar(archs,
+def BuildAar(build_dir,
+ archs,
output_file,
use_remoteexec=False,
extra_gn_args=None,
- ext_build_dir=None,
extra_gn_switches=None,
extra_ninja_switches=None,
unstripped=False):
extra_gn_args = extra_gn_args or []
extra_gn_switches = extra_gn_switches or []
extra_ninja_switches = extra_ninja_switches or []
- build_dir = ext_build_dir if ext_build_dir else tempfile.mkdtemp()
for arch in archs:
Build(build_dir, arch, use_remoteexec, extra_gn_args,
@@ -256,17 +256,19 @@ def BuildAar(archs,
license_dir = os.path.dirname(os.path.realpath(output_file))
GenerateLicenses(license_dir, build_dir, archs)
- if not ext_build_dir:
- shutil.rmtree(build_dir, True)
-
def main():
args = _ParseArgs()
logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO)
- BuildAar(args.arch, args.output, args.use_remoteexec, args.extra_gn_args,
- args.build_dir, args.extra_gn_switches, args.extra_ninja_switches,
- args.use_unstripped_libs)
+ if not pathlib.Path(args.build_dir).is_relative_to(SRC_DIR):
+ logging.error('--build-dir must be under %s.', SRC_DIR)
+ return 1
+
+ return BuildAar(args.build_dir, args.arch, args.output,
+ args.use_remoteexec, args.extra_gn_args,
+ args.extra_gn_switches, args.extra_ninja_switches,
+ args.use_unstripped_libs)
if __name__ == '__main__':