From 1edbda09d45fa4fa71f79153483b0c1aeab498fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1ri=20Tristan=20Helgason?= Date: Tue, 13 Jun 2017 10:45:42 +0200 Subject: [PATCH] Don't hardcode gn target path for licence generation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a bug where the generated license for the framework was missing all third party dependencies. Bug: None Change-Id: I81331f7f4d32e3302ce6ce0430272904820ce6d6 Reviewed-on: https://chromium-review.googlesource.com/530689 Commit-Queue: Kári Tristan Helgason Reviewed-by: Henrik Kjellander Reviewed-by: Daniela Jovanoska Petrenko Reviewed-by: Henrik Kjellander Cr-Commit-Position: refs/heads/master@{#18556} --- tools_webrtc/ios/build_ios_libs.py | 36 ++++++++++++++------------- tools_webrtc/ios/generate_licenses.py | 1 + 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/tools_webrtc/ios/build_ios_libs.py b/tools_webrtc/ios/build_ios_libs.py index 412ad6708e..0081998ad3 100755 --- a/tools_webrtc/ios/build_ios_libs.py +++ b/tools_webrtc/ios/build_ios_libs.py @@ -90,9 +90,9 @@ def _CleanTemporary(output_dir, architectures): shutil.rmtree(arch_lib_path) -def BuildWebRTC(output_dir, target_arch, flavor, build_type, +def BuildWebRTC(output_dir, target_arch, flavor, gn_target_name, ios_deployment_target, libvpx_build_vp9, use_bitcode, - use_goma, extra_gn_args): + use_goma, extra_gn_args, static_only): output_dir = os.path.join(output_dir, target_arch + '_libs') gn_args = ['target_os="ios"', 'ios_enable_code_signing=false', 'use_xcode_clang=true', 'is_component_build=false'] @@ -116,17 +116,6 @@ def BuildWebRTC(output_dir, target_arch, flavor, build_type, ('true' if use_bitcode else 'false')) gn_args.append('use_goma=' + ('true' if use_goma else 'false')) - # Generate static or dynamic. - if build_type == 'static_only': - gn_target_name = 'rtc_sdk_objc' - elif build_type == 'framework': - gn_target_name = 'objc_framework' - if not use_bitcode: - gn_args.append('enable_dsyms=true') - gn_args.append('enable_stripping=true') - else: - raise ValueError('Build type "%s" is not supported.' % build_type) - args_string = ' '.join(gn_args + extra_gn_args) logging.info('Building WebRTC with args: %s', args_string) @@ -140,7 +129,7 @@ def BuildWebRTC(output_dir, target_arch, flavor, build_type, _RunCommand(cmd) # Strip debug symbols to reduce size. - if build_type == 'static_only': + if static_only: gn_target_path = os.path.join(output_dir, 'obj', 'webrtc', 'sdk', 'lib%s.a' % gn_target_name) cmd = ['strip', '-S', gn_target_path, '-o', @@ -158,6 +147,7 @@ def main(): return 0 architectures = list(args.arch) + gn_args = args.extra_gn_args if args.purify: _CleanTemporary(args.output_dir, architectures) @@ -168,11 +158,23 @@ def main(): if 'x86' in architectures and args.build_type != 'static_only': architectures.remove('x86') + # Generate static or dynamic. + if args.build_type == 'static_only': + gn_target_name = 'rtc_sdk_objc' + elif args.build_type == 'framework': + gn_target_name = 'objc_framework' + if not args.bitcode: + gn_args.append('enable_dsyms=true') + gn_args.append('enable_stripping=true') + else: + raise ValueError('Build type "%s" is not supported.' % args.build_type) + + # Build all architectures. for arch in architectures: - BuildWebRTC(args.output_dir, arch, args.build_config, args.build_type, + BuildWebRTC(args.output_dir, arch, args.build_config, gn_target_name, IOS_DEPLOYMENT_TARGET, LIBVPX_BUILD_VP9, args.bitcode, - args.use_goma, args.extra_gn_args) + args.use_goma, gn_args, args.build_type == 'static_only') # Create FAT archive. if args.build_type == 'static_only': @@ -225,7 +227,7 @@ def main(): license_script_path = os.path.join(SCRIPT_DIR, 'generate_licenses.py') ninja_dirs = [os.path.join(args.output_dir, arch + '_libs') for arch in architectures] - gn_target_full_name = '//webrtc/sdk:rtc_sdk_framework_objc' + gn_target_full_name = '//webrtc/sdk:' + gn_target_name cmd = [sys.executable, license_script_path, gn_target_full_name, os.path.join(args.output_dir, SDK_FRAMEWORK_NAME)] + ninja_dirs _RunCommand(cmd) diff --git a/tools_webrtc/ios/generate_licenses.py b/tools_webrtc/ios/generate_licenses.py index 5c9b4cfe3b..b91314783f 100755 --- a/tools_webrtc/ios/generate_licenses.py +++ b/tools_webrtc/ios/generate_licenses.py @@ -63,6 +63,7 @@ class LicenseBuilder(object): # The `sum` function flattens the 2d list. third_party_libs = sum([GetThirdPartyLibraries(buildfile, self.target_name) for buildfile in self.buildfile_dirs], []) + assert len(third_party_libs) > 0 # Generate amalgamated list of libraries. Will exit with error if a # lib is unrecognized.