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

Side by Side Diff: tools-webrtc/ios/build_ios_libs.py

Issue 2705163007: Do not produce dSYM file for the iOS Frameworks with bitcode (Closed)
Patch Set: Do not produce dSYM file for the iOS Frameworks with bitcode Created 3 years, 9 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 | « no previous file | no next file » | 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 gn_args.append('enable_ios_bitcode=' + 104 gn_args.append('enable_ios_bitcode=' +
105 ('true' if use_bitcode else 'false')) 105 ('true' if use_bitcode else 'false'))
106 gn_args.append('use_goma=' + ('true' if use_goma else 'false')) 106 gn_args.append('use_goma=' + ('true' if use_goma else 'false'))
107 107
108 # Generate static or dynamic. 108 # Generate static or dynamic.
109 if build_type == 'static_only': 109 if build_type == 'static_only':
110 gn_target_name = 'rtc_sdk_objc' 110 gn_target_name = 'rtc_sdk_objc'
111 elif build_type == 'framework': 111 elif build_type == 'framework':
112 gn_target_name = 'rtc_sdk_framework_objc' 112 gn_target_name = 'rtc_sdk_framework_objc'
113 gn_args.append('enable_dsyms=true') 113 if not use_bitcode:
114 gn_args.append('enable_dsyms=true')
114 gn_args.append('enable_stripping=true') 115 gn_args.append('enable_stripping=true')
115 else: 116 else:
116 raise ValueError('Build type "%s" is not supported.' % build_type) 117 raise ValueError('Build type "%s" is not supported.' % build_type)
117 118
118 args_string = ' '.join(gn_args + extra_gn_args) 119 args_string = ' '.join(gn_args + extra_gn_args)
119 logging.info('Building WebRTC with args: %s', args_string) 120 logging.info('Building WebRTC with args: %s', args_string)
120 121
121 cmd = ['gn', 'gen', output_dir, '--args=' + args_string] 122 cmd = ['gn', 'gen', output_dir, '--args=' + args_string]
122 _RunCommand(cmd) 123 _RunCommand(cmd)
123 logging.info('Building target: %s', gn_target_name) 124 logging.info('Building target: %s', gn_target_name)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 lib_paths = [os.path.join(args.output_dir, arch + '_libs') 171 lib_paths = [os.path.join(args.output_dir, arch + '_libs')
171 for arch in architectures] 172 for arch in architectures]
172 173
173 # Combine the slices. 174 # Combine the slices.
174 dylib_path = os.path.join(SDK_FRAMEWORK_NAME, 'WebRTC') 175 dylib_path = os.path.join(SDK_FRAMEWORK_NAME, 'WebRTC')
175 # Dylibs will be combined, all other files are the same across archs. 176 # Dylibs will be combined, all other files are the same across archs.
176 # Use distutils instead of shutil to support merging folders. 177 # Use distutils instead of shutil to support merging folders.
177 distutils.dir_util.copy_tree( 178 distutils.dir_util.copy_tree(
178 os.path.join(lib_paths[0], SDK_FRAMEWORK_NAME), 179 os.path.join(lib_paths[0], SDK_FRAMEWORK_NAME),
179 os.path.join(args.output_dir, SDK_FRAMEWORK_NAME)) 180 os.path.join(args.output_dir, SDK_FRAMEWORK_NAME))
180 try:
181 os.remove(os.path.join(args.output_dir, dylib_path))
182 except OSError:
183 pass
184 logging.info('Merging framework slices.') 181 logging.info('Merging framework slices.')
185 dylib_paths = [os.path.join(path, dylib_path) for path in lib_paths] 182 dylib_paths = [os.path.join(path, dylib_path) for path in lib_paths]
186 out_dylib_path = os.path.join(args.output_dir, dylib_path) 183 out_dylib_path = os.path.join(args.output_dir, dylib_path)
184 try:
185 os.remove(out_dylib_path)
186 except OSError:
187 pass
187 cmd = ['lipo'] + dylib_paths + ['-create', '-output', out_dylib_path] 188 cmd = ['lipo'] + dylib_paths + ['-create', '-output', out_dylib_path]
188 _RunCommand(cmd) 189 _RunCommand(cmd)
189 190
190 # Merge the dSYM slices. 191 # Merge the dSYM slices.
191 dsym_path = os.path.join('WebRTC.dSYM', 'Contents', 'Resources', 'DWARF', 192 lib_dsym_dir_path = os.path.join(lib_paths[0], 'WebRTC.dSYM')
192 'WebRTC') 193 if os.path.isdir(lib_dsym_dir_path):
193 distutils.dir_util.copy_tree(os.path.join(lib_paths[0], 'WebRTC.dSYM'), 194 distutils.dir_util.copy_tree(lib_dsym_dir_path,
194 os.path.join(args.output_dir, 'WebRTC.dSYM')) 195 os.path.join(args.output_dir, 'WebRTC.dSYM'))
195 try: 196 logging.info('Merging dSYM slices.')
196 os.remove(os.path.join(args.output_dir, dsym_path)) 197 dsym_path = os.path.join('WebRTC.dSYM', 'Contents', 'Resources', 'DWARF',
197 except OSError: 198 'WebRTC')
198 pass 199 lib_dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths]
199 logging.info('Merging dSYM slices.') 200 out_dsym_path = os.path.join(args.output_dir, dsym_path)
200 dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths] 201 try:
201 out_dsym_path = os.path.join(args.output_dir, dsym_path) 202 os.remove(out_dsym_path)
202 cmd = ['lipo'] + dsym_paths + ['-create', '-output', out_dsym_path] 203 except OSError:
203 _RunCommand(cmd) 204 pass
205 cmd = ['lipo'] + lib_dsym_paths + ['-create', '-output', out_dsym_path]
206 _RunCommand(cmd)
204 207
205 # Modify the version number. 208 # Modify the version number.
206 # Format should be <Branch cut MXX>.<Hotfix #>.<Rev #>. 209 # Format should be <Branch cut MXX>.<Hotfix #>.<Rev #>.
207 # e.g. 55.0.14986 means branch cut 55, no hotfixes, and revision 14986. 210 # e.g. 55.0.14986 means branch cut 55, no hotfixes, and revision 14986.
208 infoplist_path = os.path.join(args.output_dir, SDK_FRAMEWORK_NAME, 211 infoplist_path = os.path.join(args.output_dir, SDK_FRAMEWORK_NAME,
209 'Info.plist') 212 'Info.plist')
210 cmd = ['PlistBuddy', '-c', 213 cmd = ['PlistBuddy', '-c',
211 'Print :CFBundleShortVersionString', infoplist_path] 214 'Print :CFBundleShortVersionString', infoplist_path]
212 major_minor = subprocess.check_output(cmd).strip() 215 major_minor = subprocess.check_output(cmd).strip()
213 version_number = '%s.%s' % (major_minor, args.revision) 216 version_number = '%s.%s' % (major_minor, args.revision)
214 logging.info('Substituting revision number: %s', version_number) 217 logging.info('Substituting revision number: %s', version_number)
215 cmd = ['PlistBuddy', '-c', 218 cmd = ['PlistBuddy', '-c',
216 'Set :CFBundleVersion ' + version_number, infoplist_path] 219 'Set :CFBundleVersion ' + version_number, infoplist_path]
217 _RunCommand(cmd) 220 _RunCommand(cmd)
218 _RunCommand(['plutil', '-convert', 'binary1', infoplist_path]) 221 _RunCommand(['plutil', '-convert', 'binary1', infoplist_path])
219 222
220 logging.info('Done.') 223 logging.info('Done.')
221 return 0 224 return 0
222 225
223 226
224 if __name__ == '__main__': 227 if __name__ == '__main__':
225 sys.exit(main()) 228 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698