From d74517c52a6cd4172b1f3fdc4e624b6145ff5a0f Mon Sep 17 00:00:00 2001 From: VladimirTechMan Date: Sat, 25 Feb 2017 02:08:27 -0800 Subject: [PATCH] Do not produce dSYM file for the iOS Frameworks with bitcode Though dSYM files can be generated when building applications or libraries with bitcode. They cannot be used to symbolicate crash reports from applications. Instead, developers need to grab the real dSYM files, which are generated for each specific device type after uploading an iOS / tvOS application to App Store (or to a device using Xcode). Apple clearly warns about it in its documentation: https://developer.apple.com/library/content/technotes/tn2151/_index.html#//apple_ref/doc/uid/DTS40008184-CH1-SYMBOLICATION-BITCODE With that in mind, I believe that it would be better to not confuse developers by giving them dSYM files that are not very helpful with the bitcode-enabled framework. Thus, proposing the following modification to the building script, to generate dSYM by default only without the bitcode option. However, if some developers still want to get the dSYM files as a build-process artifact, when enabling bitcode, they can explicitly add --extra-gn-args enable_dsyms=true to the script. Let me know if it lgty. NOTRY=True BUG=None Review-Url: https://codereview.webrtc.org/2705163007 Cr-Commit-Position: refs/heads/master@{#16836} --- tools-webrtc/ios/build_ios_libs.py | 39 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/tools-webrtc/ios/build_ios_libs.py b/tools-webrtc/ios/build_ios_libs.py index 25745e0351..7af47716c5 100755 --- a/tools-webrtc/ios/build_ios_libs.py +++ b/tools-webrtc/ios/build_ios_libs.py @@ -110,7 +110,8 @@ def BuildWebRTC(output_dir, target_arch, flavor, build_type, gn_target_name = 'rtc_sdk_objc' elif build_type == 'framework': gn_target_name = 'rtc_sdk_framework_objc' - gn_args.append('enable_dsyms=true') + 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) @@ -177,30 +178,32 @@ def main(): distutils.dir_util.copy_tree( os.path.join(lib_paths[0], SDK_FRAMEWORK_NAME), os.path.join(args.output_dir, SDK_FRAMEWORK_NAME)) - try: - os.remove(os.path.join(args.output_dir, dylib_path)) - except OSError: - pass logging.info('Merging framework slices.') dylib_paths = [os.path.join(path, dylib_path) for path in lib_paths] out_dylib_path = os.path.join(args.output_dir, dylib_path) + try: + os.remove(out_dylib_path) + except OSError: + pass cmd = ['lipo'] + dylib_paths + ['-create', '-output', out_dylib_path] _RunCommand(cmd) # Merge the dSYM slices. - dsym_path = os.path.join('WebRTC.dSYM', 'Contents', 'Resources', 'DWARF', - 'WebRTC') - distutils.dir_util.copy_tree(os.path.join(lib_paths[0], 'WebRTC.dSYM'), - os.path.join(args.output_dir, 'WebRTC.dSYM')) - try: - os.remove(os.path.join(args.output_dir, dsym_path)) - except OSError: - pass - logging.info('Merging dSYM slices.') - dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths] - out_dsym_path = os.path.join(args.output_dir, dsym_path) - cmd = ['lipo'] + dsym_paths + ['-create', '-output', out_dsym_path] - _RunCommand(cmd) + lib_dsym_dir_path = os.path.join(lib_paths[0], 'WebRTC.dSYM') + if os.path.isdir(lib_dsym_dir_path): + distutils.dir_util.copy_tree(lib_dsym_dir_path, + os.path.join(args.output_dir, 'WebRTC.dSYM')) + logging.info('Merging dSYM slices.') + dsym_path = os.path.join('WebRTC.dSYM', 'Contents', 'Resources', 'DWARF', + 'WebRTC') + lib_dsym_paths = [os.path.join(path, dsym_path) for path in lib_paths] + out_dsym_path = os.path.join(args.output_dir, dsym_path) + try: + os.remove(out_dsym_path) + except OSError: + pass + cmd = ['lipo'] + lib_dsym_paths + ['-create', '-output', out_dsym_path] + _RunCommand(cmd) # Modify the version number. # Format should be ...