Skip to content

Commit

Permalink
Double zip FlutterMacOS.dSYM.zip. (flutter#41425)
Browse files Browse the repository at this point in the history
The flutter tool is expecting FlutterMacOS.dSYM.zip to be double zipped.

Bug: flutter/flutter#124911

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
  • Loading branch information
godofredoc authored Apr 25, 2023
1 parent 6d79839 commit 34ece7a
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions sky/tools/create_macos_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -152,37 +164,44 @@ 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([
'zip',
'-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)

Expand Down

0 comments on commit 34ece7a

Please sign in to comment.