Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: tools_webrtc/ios/build_ios_libs.py

Issue 3011613002: License generation script for build_aar.py. (Closed)
Patch Set: Specify GN working directory. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools_webrtc/android/build_aar.py ('k') | tools_webrtc/ios/generate_licenses.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 3 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license 5 # Use of this source code is governed by a BSD-style license
6 # that can be found in the LICENSE file in the root of the source 6 # that can be found in the LICENSE file in the root of the source
7 # tree. An additional intellectual property rights grant can be found 7 # tree. An additional intellectual property rights grant can be found
8 # in the file PATENTS. All contributing project authors may 8 # in the file PATENTS. All contributing project authors may
9 # be found in the AUTHORS file in the root of the source tree. 9 # be found in the AUTHORS file in the root of the source tree.
10 10
(...skipping 16 matching lines...) Expand all
27 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) 27 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
28 WEBRTC_SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..')) 28 WEBRTC_SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..'))
29 SDK_OUTPUT_DIR = os.path.join(WEBRTC_SRC_DIR, 'out_ios_libs') 29 SDK_OUTPUT_DIR = os.path.join(WEBRTC_SRC_DIR, 'out_ios_libs')
30 SDK_LIB_NAME = 'librtc_sdk_objc.a' 30 SDK_LIB_NAME = 'librtc_sdk_objc.a'
31 SDK_FRAMEWORK_NAME = 'WebRTC.framework' 31 SDK_FRAMEWORK_NAME = 'WebRTC.framework'
32 32
33 DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64', 'arm', 'x64', 'x86'] 33 DEFAULT_ARCHS = ENABLED_ARCHS = ['arm64', 'arm', 'x64', 'x86']
34 IOS_DEPLOYMENT_TARGET = '8.0' 34 IOS_DEPLOYMENT_TARGET = '8.0'
35 LIBVPX_BUILD_VP9 = False 35 LIBVPX_BUILD_VP9 = False
36 36
37 sys.path.append(os.path.join(SCRIPT_DIR, '..', 'libs'))
38 from generate_licenses import LicenseBuilder
39
37 40
38 def _ParseArgs(): 41 def _ParseArgs():
39 parser = argparse.ArgumentParser(description=__doc__) 42 parser = argparse.ArgumentParser(description=__doc__)
40 parser.add_argument('-b', '--build_type', default='framework', 43 parser.add_argument('-b', '--build_type', default='framework',
41 choices=['framework', 'static_only'], 44 choices=['framework', 'static_only'],
42 help='The build type. Can be "framework" or "static_only". ' 45 help='The build type. Can be "framework" or "static_only". '
43 'Defaults to "framework".') 46 'Defaults to "framework".')
44 parser.add_argument('--build_config', default='release', 47 parser.add_argument('--build_config', default='release',
45 choices=['debug', 'release'], 48 choices=['debug', 'release'],
46 help='The build config. Can be "debug" or "release". ' 49 help='The build config. Can be "debug" or "release". '
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 lib_dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths] 220 lib_dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths]
218 out_dsym_path = os.path.join(args.output_dir, dsym_path) 221 out_dsym_path = os.path.join(args.output_dir, dsym_path)
219 try: 222 try:
220 os.remove(out_dsym_path) 223 os.remove(out_dsym_path)
221 except OSError: 224 except OSError:
222 pass 225 pass
223 cmd = ['lipo'] + lib_dsym_paths + ['-create', '-output', out_dsym_path] 226 cmd = ['lipo'] + lib_dsym_paths + ['-create', '-output', out_dsym_path]
224 _RunCommand(cmd) 227 _RunCommand(cmd)
225 228
226 # Generate the license file. 229 # Generate the license file.
227 license_script_path = os.path.join(SCRIPT_DIR, 'generate_licenses.py')
228 ninja_dirs = [os.path.join(args.output_dir, arch + '_libs') 230 ninja_dirs = [os.path.join(args.output_dir, arch + '_libs')
229 for arch in architectures] 231 for arch in architectures]
230 gn_target_full_name = '//webrtc/sdk:' + gn_target_name 232 gn_target_full_name = '//webrtc/sdk:' + gn_target_name
231 cmd = [sys.executable, license_script_path, gn_target_full_name, 233 builder = LicenseBuilder(ninja_dirs, [gn_target_full_name])
232 os.path.join(args.output_dir, SDK_FRAMEWORK_NAME)] + ninja_dirs 234 builder.GenerateLicenseText(
233 _RunCommand(cmd) 235 os.path.join(args.output_dir, SDK_FRAMEWORK_NAME))
236
234 237
235 # Modify the version number. 238 # Modify the version number.
236 # Format should be <Branch cut MXX>.<Hotfix #>.<Rev #>. 239 # Format should be <Branch cut MXX>.<Hotfix #>.<Rev #>.
237 # e.g. 55.0.14986 means branch cut 55, no hotfixes, and revision 14986. 240 # e.g. 55.0.14986 means branch cut 55, no hotfixes, and revision 14986.
238 infoplist_path = os.path.join(args.output_dir, SDK_FRAMEWORK_NAME, 241 infoplist_path = os.path.join(args.output_dir, SDK_FRAMEWORK_NAME,
239 'Info.plist') 242 'Info.plist')
240 cmd = ['PlistBuddy', '-c', 243 cmd = ['PlistBuddy', '-c',
241 'Print :CFBundleShortVersionString', infoplist_path] 244 'Print :CFBundleShortVersionString', infoplist_path]
242 major_minor = subprocess.check_output(cmd).strip() 245 major_minor = subprocess.check_output(cmd).strip()
243 version_number = '%s.%s' % (major_minor, args.revision) 246 version_number = '%s.%s' % (major_minor, args.revision)
244 logging.info('Substituting revision number: %s', version_number) 247 logging.info('Substituting revision number: %s', version_number)
245 cmd = ['PlistBuddy', '-c', 248 cmd = ['PlistBuddy', '-c',
246 'Set :CFBundleVersion ' + version_number, infoplist_path] 249 'Set :CFBundleVersion ' + version_number, infoplist_path]
247 _RunCommand(cmd) 250 _RunCommand(cmd)
248 _RunCommand(['plutil', '-convert', 'binary1', infoplist_path]) 251 _RunCommand(['plutil', '-convert', 'binary1', infoplist_path])
249 252
250 logging.info('Done.') 253 logging.info('Done.')
251 return 0 254 return 0
252 255
253 256
254 if __name__ == '__main__': 257 if __name__ == '__main__':
255 sys.exit(main()) 258 sys.exit(main())
OLDNEW
« no previous file with comments | « tools_webrtc/android/build_aar.py ('k') | tools_webrtc/ios/generate_licenses.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698