From fbb3fc3af84a8e8c0a2c488199725332011f76c3 Mon Sep 17 00:00:00 2001 From: godofredoc Date: Tue, 25 Apr 2023 14:02:06 -0700 Subject: [PATCH] Double zip FlutterMacOS.dSYM.zip. (flutter/engine#41425) The flutter tool is expecting FlutterMacOS.dSYM.zip to be double zipped. Bug: https://github.com/flutter/flutter/issues/124911 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../sky/tools/create_macos_framework.py | 53 +++++++++++++------ 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/engine/src/flutter/sky/tools/create_macos_framework.py b/engine/src/flutter/sky/tools/create_macos_framework.py index 8e194ebbe69..bbe047fad0a 100755 --- a/engine/src/flutter/sky/tools/create_macos_framework.py +++ b/engine/src/flutter/sky/tools/create_macos_framework.py @@ -137,10 +137,22 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM' subprocess.check_call([DSYMUTIL, '-o', dsym_out, fat_framework_binary]) if args.zip: + dsym_dst = os.path.join(dst, 'FlutterMacOS.dSYM') + subprocess.check_call(['zip', '-r', '-y', 'FlutterMacOS.dSYM.zip', '.'], + cwd=dsym_dst) + # Double zip to make it consistent with legacy artifacts. + # TODO(fujino): remove this once https://github.com/flutter/flutter/issues/125067 is resolved subprocess.check_call([ - 'zip', '-r', '-y', 'FlutterMacOS.dSYM.zip', 'FlutterMacOS.dSYM' + 'zip', + '-y', + 'FlutterMacOS.dSYM_.zip', + 'FlutterMacOS.dSYM.zip', ], - cwd=dst) + cwd=dsym_dst) + # Use doubled zipped file. + dsym_final_src_path = os.path.join(dsym_dst, 'FlutterMacOS.dSYM_.zip') + dsym_final_dst_path = os.path.join(dst, 'FlutterMacOS.dSYM.zip') + shutil.move(dsym_final_src_path, dsym_final_dst_path) if args.strip: # copy unstripped @@ -152,14 +164,18 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): # Zip FlutterMacOS.framework. if args.zip: filepath_with_entitlements = '' - filepath_without_entitlements = 'FlutterMacOS.framework/Versions/A/FlutterMacOS' + + framework_dst = os.path.join(dst, 'FlutterMacOS.framework') + # TODO(xilaizhang): Remove the zip file from the path when outer zip is removed. + filepath_without_entitlements = 'FlutterMacOS.framework.zip/Versions/A/FlutterMacOS' embed_codesign_configuration( - os.path.join(dst, 'entitlements.txt'), filepath_with_entitlements + os.path.join(framework_dst, 'entitlements.txt'), + filepath_with_entitlements ) embed_codesign_configuration( - os.path.join(dst, 'without_entitlements.txt'), + os.path.join(framework_dst, 'without_entitlements.txt'), filepath_without_entitlements ) subprocess.check_call([ @@ -167,22 +183,25 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): '-r', '-y', 'FlutterMacOS.framework.zip', - 'FlutterMacOS.framework', - 'entitlements.txt', - 'without_entitlements.txt', + '.', ], - cwd=dst) + cwd=framework_dst) # Double zip to make it consistent with legacy artifacts. # TODO(fujino): remove this once https://github.com/flutter/flutter/issues/125067 is resolved - subprocess.check_call([ - 'zip', - '-y', - 'FlutterMacOS.framework_.zip', - 'FlutterMacOS.framework.zip', - ], - cwd=dst) + subprocess.check_call( + [ + 'zip', + '-y', + 'FlutterMacOS.framework_.zip', + 'FlutterMacOS.framework.zip', + # TODO(xilaizhang): Move these files to inner zip before removing the outer zip. + 'entitlements.txt', + 'without_entitlements.txt', + ], + cwd=framework_dst + ) # Use doubled zipped file. - final_src_path = os.path.join(dst, 'FlutterMacOS.framework_.zip') + final_src_path = os.path.join(framework_dst, 'FlutterMacOS.framework_.zip') final_dst_path = os.path.join(dst, 'FlutterMacOS.framework.zip') shutil.move(final_src_path, final_dst_path)