diff --git a/tools_webrtc/android/build_aar.py b/tools_webrtc/android/build_aar.py index b442358283..85c1411fde 100755 --- a/tools_webrtc/android/build_aar.py +++ b/tools_webrtc/android/build_aar.py @@ -65,10 +65,6 @@ def _ParseArgs(): default=DEFAULT_ARCHS, nargs='*', help='Architectures to build. Defaults to %(default)s.') - parser.add_argument('--use-goma', - action='store_true', - default=False, - help='Use goma.') parser.add_argument('--use-remoteexec', action='store_true', default=False, @@ -168,8 +164,8 @@ def _GetArmVersion(arch): raise Exception('Unknown arch: ' + arch) -def Build(build_dir, arch, use_goma, use_remoteexec, extra_gn_args, - extra_gn_switches, extra_ninja_switches): +def Build(build_dir, arch, use_remoteexec, extra_gn_args, extra_gn_switches, + extra_ninja_switches): """Generates target architecture using GN and builds it using ninja.""" logging.info('Building: %s', arch) output_directory = _GetOutputDirectory(build_dir, arch) @@ -179,7 +175,6 @@ def Build(build_dir, arch, use_goma, use_remoteexec, extra_gn_args, 'is_component_build': False, 'rtc_include_tests': False, 'target_cpu': _GetTargetCpu(arch), - 'use_goma': use_goma, 'use_remoteexec': use_remoteexec, } arm_version = _GetArmVersion(arch) @@ -194,7 +189,7 @@ def Build(build_dir, arch, use_goma, use_remoteexec, extra_gn_args, _RunGN(gn_args_list) ninja_args = TARGETS[:] - if use_goma or use_remoteexec: + if use_remoteexec: ninja_args.extend(['-j', '200']) ninja_args.extend(extra_ninja_switches) _RunNinja(output_directory, ninja_args) @@ -229,7 +224,6 @@ def GenerateLicenses(output_dir, build_dir, archs): def BuildAar(archs, output_file, - use_goma=False, use_remoteexec=False, extra_gn_args=None, ext_build_dir=None, @@ -242,7 +236,7 @@ def BuildAar(archs, build_dir = ext_build_dir if ext_build_dir else tempfile.mkdtemp() for arch in archs: - Build(build_dir, arch, use_goma, use_remoteexec, extra_gn_args, + Build(build_dir, arch, use_remoteexec, extra_gn_args, extra_gn_switches, extra_ninja_switches) with zipfile.ZipFile(output_file, 'w') as aar_file: @@ -262,9 +256,9 @@ def main(): args = _ParseArgs() logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO) - BuildAar(args.arch, args.output, args.use_goma, args.use_remoteexec, - args.extra_gn_args, args.build_dir, args.extra_gn_switches, - args.extra_ninja_switches, args.use_unstripped_libs) + 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 __name__ == '__main__': diff --git a/tools_webrtc/android/test_aar.py b/tools_webrtc/android/test_aar.py index 7eb281aa9a..2d4ce1f0d5 100755 --- a/tools_webrtc/android/test_aar.py +++ b/tools_webrtc/android/test_aar.py @@ -34,110 +34,111 @@ ADB_BIN = os.path.join(CHECKOUT_ROOT, AAR_PROJECT_DIR = os.path.join(CHECKOUT_ROOT, 'examples/aarproject') -def _ParseArgs(): - parser = argparse.ArgumentParser(description='Releases WebRTC on Bintray.') - parser.add_argument('--use-goma', - action='store_true', - default=False, - help='Use goma.') - parser.add_argument('--skip-tests', - action='store_true', - default=False, - help='Skips running the tests.') - parser.add_argument( - '--build-dir', - default=None, - help='Temporary directory to store the build files. If not specified, ' - 'a new directory will be created.') - parser.add_argument('--verbose', - action='store_true', - default=False, - help='Debug logging.') - return parser.parse_args() +def _parse_args(): + parser = argparse.ArgumentParser(description='Releases WebRTC on Bintray.') + parser.add_argument('--use-remoteexec', + action='store_true', + default=False, + help='Use RBE.') + parser.add_argument('--skip-tests', + action='store_true', + default=False, + help='Skips running the tests.') + parser.add_argument( + '--build-dir', + default=None, + help='Temporary directory to store the build files. If not specified, ' + 'a new directory will be created.') + parser.add_argument('--verbose', + action='store_true', + default=False, + help='Debug logging.') + return parser.parse_args() -def _GetCommitHash(): - commit_hash = subprocess.check_output( - ['git', 'rev-parse', 'HEAD'], cwd=CHECKOUT_ROOT).decode('UTF-8').strip() - return commit_hash +def _get_commit_hash(): + commit_hash = subprocess.check_output( + ['git', 'rev-parse', 'HEAD'], + cwd=CHECKOUT_ROOT).decode('UTF-8').strip() + return commit_hash -def _GetCommitPos(): - commit_message = subprocess.check_output( - ['git', 'rev-list', '--format=%B', '--max-count=1', 'HEAD'], - cwd=CHECKOUT_ROOT).decode('UTF-8') - commit_pos_match = re.search(COMMIT_POSITION_REGEX, commit_message, - re.MULTILINE) - if not commit_pos_match: - raise Exception('Commit position not found in the commit message: %s' % - commit_message) - return commit_pos_match.group(1) +def _get_commit_pos(): + commit_message = subprocess.check_output( + ['git', 'rev-list', '--format=%B', '--max-count=1', 'HEAD'], + cwd=CHECKOUT_ROOT).decode('UTF-8') + commit_pos_match = re.search(COMMIT_POSITION_REGEX, commit_message, + re.MULTILINE) + if not commit_pos_match: + raise Exception('Commit position not found in the commit message: %s' % + commit_message) + return commit_pos_match.group(1) -def _TestAAR(build_dir): - """Runs AppRTCMobile tests using the AAR. Returns true if the tests pass.""" - logging.info('Testing library.') +def _test_aar(build_dir): + """Runs AppRTCMobile tests using AAR. Returns true if the tests pass.""" + logging.info('Testing library.') - # Uninstall any existing version of AppRTCMobile. - logging.info('Uninstalling previous AppRTCMobile versions. It is okay for ' - 'these commands to fail if AppRTCMobile is not installed.') - subprocess.call([ADB_BIN, 'uninstall', 'org.appspot.apprtc']) - subprocess.call([ADB_BIN, 'uninstall', 'org.appspot.apprtc.test']) + # Uninstall any existing version of AppRTCMobile. + logging.info('Uninstalling previous AppRTCMobile versions. It is okay for ' + 'these commands to fail if AppRTCMobile is not installed.') + subprocess.call([ADB_BIN, 'uninstall', 'org.appspot.apprtc']) + subprocess.call([ADB_BIN, 'uninstall', 'org.appspot.apprtc.test']) - # Run tests. - try: - # First clean the project. - subprocess.check_call([GRADLEW_BIN, 'clean'], cwd=AAR_PROJECT_DIR) - # Then run the tests. - subprocess.check_call([ - GRADLEW_BIN, 'connectedDebugAndroidTest', - '-PaarDir=' + os.path.abspath(build_dir) - ], - cwd=AAR_PROJECT_DIR) - except subprocess.CalledProcessError: - logging.exception('Test failure.') - return False # Clean or tests failed + # Run tests. + try: + # First clean the project. + subprocess.check_call([GRADLEW_BIN, 'clean'], cwd=AAR_PROJECT_DIR) + # Then run the tests. + subprocess.check_call([ + GRADLEW_BIN, 'connectedDebugAndroidTest', + '-PaarDir=' + os.path.abspath(build_dir) + ], + cwd=AAR_PROJECT_DIR) + except subprocess.CalledProcessError: + logging.exception('Test failure.') + return False # Clean or tests failed - return True # Tests pass + return True # Tests pass -def BuildAndTestAar(use_goma, skip_tests, build_dir): - version = '1.0.' + _GetCommitPos() - commit = _GetCommitHash() - logging.info('Building and Testing AAR version %s with hash %s', version, - commit) +def build_and_test_aar(use_remoteexec, skip_tests, build_dir): + version = '1.0.' + _get_commit_pos() + commit = _get_commit_hash() + logging.info('Building and Testing AAR version %s with hash %s', version, + commit) - # If build directory is not specified, create a temporary directory. - use_tmp_dir = not build_dir - if use_tmp_dir: - build_dir = tempfile.mkdtemp() - - try: - base_name = ARTIFACT_ID + '-' + version - aar_file = os.path.join(build_dir, base_name + '.aar') - - logging.info('Building at %s', build_dir) - BuildAar(ARCHS, - aar_file, - use_goma=use_goma, - ext_build_dir=os.path.join(build_dir, 'aar-build')) - - tests_pass = skip_tests or _TestAAR(build_dir) - if not tests_pass: - raise Exception('Test failure.') - - logging.info('Test success.') - - finally: + # If build directory is not specified, create a temporary directory. + use_tmp_dir = not build_dir if use_tmp_dir: - shutil.rmtree(build_dir, True) + build_dir = tempfile.mkdtemp() + + try: + base_name = ARTIFACT_ID + '-' + version + aar_file = os.path.join(build_dir, base_name + '.aar') + + logging.info('Building at %s', build_dir) + BuildAar(ARCHS, + aar_file, + use_remoteexec=use_remoteexec, + ext_build_dir=os.path.join(build_dir, 'aar-build')) + + tests_pass = skip_tests or _test_aar(build_dir) + if not tests_pass: + raise Exception('Test failure.') + + logging.info('Test success.') + + finally: + if use_tmp_dir: + shutil.rmtree(build_dir, True) def main(): - args = _ParseArgs() - logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO) - BuildAndTestAar(args.use_goma, args.skip_tests, args.build_dir) + args = _parse_args() + logging.basicConfig(level=logging.DEBUG if args.verbose else logging.INFO) + build_and_test_aar(args.use_remoteexec, args.skip_tests, args.build_dir) if __name__ == '__main__': - sys.exit(main()) + sys.exit(main()) diff --git a/tools_webrtc/ios/build_ios_libs.py b/tools_webrtc/ios/build_ios_libs.py index 2f4e997ada..933a636bdd 100755 --- a/tools_webrtc/ios/build_ios_libs.py +++ b/tools_webrtc/ios/build_ios_libs.py @@ -93,10 +93,6 @@ def _ParseArgs(): action='store_true', default=False, help='Debug logging.') - parser.add_argument('--use-goma', - action='store_true', - default=False, - help='Use goma to build.') parser.add_argument('--use-remoteexec', action='store_true', default=False, @@ -167,7 +163,7 @@ def _VersionMax(*versions): def BuildWebRTC(output_dir, target_environment, target_arch, flavor, gn_target_name, ios_deployment_target, libvpx_build_vp9, - use_goma, use_remoteexec, extra_gn_args): + use_remoteexec, extra_gn_args): gn_args = [ 'target_os="ios"', 'ios_enable_code_signing=false', @@ -193,7 +189,6 @@ def BuildWebRTC(output_dir, target_environment, target_arch, flavor, ('true' if libvpx_build_vp9 else 'false')) gn_args.append('use_lld=true') - gn_args.append('use_goma=' + ('true' if use_goma else 'false')) gn_args.append('use_remoteexec=' + ('true' if use_remoteexec else 'false')) gn_args.append('rtc_enable_objc_symbol_export=true') @@ -216,7 +211,7 @@ def BuildWebRTC(output_dir, target_environment, target_arch, flavor, output_dir, gn_target_name, ] - if use_goma or use_remoteexec: + if use_remoteexec: cmd.extend(['-j', '200']) _RunCommand(cmd) @@ -258,8 +253,7 @@ def main(): lib_paths.append(lib_path) BuildWebRTC(lib_path, environment, arch, args.build_config, gn_target_name, ios_deployment_target, - LIBVPX_BUILD_VP9, args.use_goma, args.use_remoteexec, - gn_args) + LIBVPX_BUILD_VP9, args.use_remoteexec, gn_args) all_lib_paths.extend(lib_paths) # Combine the slices. diff --git a/tools_webrtc/mb/docs/user_guide.md b/tools_webrtc/mb/docs/user_guide.md index 8c66cd328c..79fad06093 100644 --- a/tools_webrtc/mb/docs/user_guide.md +++ b/tools_webrtc/mb/docs/user_guide.md @@ -132,10 +132,6 @@ You can pass the `-q/--quiet` flag to get mb to be silent unless there is an error, and pass the `-v/--verbose` flag to get mb to log all of the files that are read and written, and all the commands that are run. -If the build config will use the Goma distributed-build system, you can pass -the path to your Goma client in the `-g/--goma-dir` flag, and it will be -incorporated into the appropriate flags for GYP or GN as needed. - If gen ends up using GYP, the path must have a valid GYP configuration as the last component of the path (i.e., specify `//out/Release_x64`, not `//out`). The gyp script defaults to `//build/gyp_chromium`, but can be overridden with @@ -248,8 +244,8 @@ For example, if you had: } 'mixins': { 'bot': { - 'gyp_defines': 'use_goma=1 dcheck_always_on=0', - 'gn_args': 'use_goma=true dcheck_always_on=false', + 'gyp_defines': 'use_remoteexec=1 dcheck_always_on=0', + 'gn_args': 'use_remoteexec=true dcheck_always_on=false', }, 'debug': { 'gn_args': 'is_debug=true', @@ -276,7 +272,7 @@ For example, if you had: and you ran `mb gen -c linux_release_trybot //out/Release`, it would translate into a call to `gyp_chromium -G Release` with `GYP_DEFINES` set to -`"use_goma=true dcheck_always_on=false dcheck_always_on=true"`. +`"use_remoteexec=true dcheck_always_on=false dcheck_always_on=true"`. (From that you can see that mb is intentionally dumb and does not attempt to de-dup the flags, it lets gyp do that).