From 90feb3b4c0901a01905b793836c9118218734bad Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Fri, 17 Feb 2023 15:49:18 -0800 Subject: [PATCH 1/2] [gn + codesign] mac code sign configuration for FlutterMacOS.framework.zip (#35707) * embed codesign config in macos framework * format files * update path * y flag for outer layer zip * simplify structure * format files --- sky/tools/create_macos_framework.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index a354626ddc9e2..6da93d425789a 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -127,6 +127,11 @@ def regenerate_symlinks(fat_framework): ) +def embed_codesign_configuration(config_path, content): + with open(config_path, 'w') as f: + f.write(content) + + def process_framework(dst, args, fat_framework, fat_framework_binary): if args.dsym: dsym_out = os.path.splitext(fat_framework)[0] + '.dSYM' @@ -146,9 +151,25 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): # Zip FlutterMacOS.framework. if args.zip: + macos_filepath_with_entitlements = '' + macos_filepath_without_entitlements = 'FlutterMacOS.framework/Versions/A/FlutterMacOS' + + embed_codesign_configuration( + os.path.join(dst, 'entitlements.txt'), macos_filepath_with_entitlements + ) + + embed_codesign_configuration( + os.path.join(dst, 'without_entitlements.txt'), + macos_filepath_without_entitlements + ) subprocess.check_call([ - 'zip', '-r', '-y', 'FlutterMacOS.framework.zip', - 'FlutterMacOS.framework' + 'zip', + '-r', + '-y', + 'FlutterMacOS.framework.zip', + 'FlutterMacOS.framework', + 'entitlements.txt', + 'without_entitlements.txt', ], cwd=dst) From 69ac850f972b912cbaa304022fc38f07662a4b63 Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Tue, 21 Mar 2023 17:32:46 -0700 Subject: [PATCH 2/2] fix variable name based on lint check --- sky/tools/create_macos_framework.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index 6da93d425789a..8f7a34c19d486 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -128,8 +128,8 @@ def regenerate_symlinks(fat_framework): def embed_codesign_configuration(config_path, content): - with open(config_path, 'w') as f: - f.write(content) + with open(config_path, 'w') as file: + file.write(content) def process_framework(dst, args, fat_framework, fat_framework_binary): @@ -151,16 +151,16 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): # Zip FlutterMacOS.framework. if args.zip: - macos_filepath_with_entitlements = '' - macos_filepath_without_entitlements = 'FlutterMacOS.framework/Versions/A/FlutterMacOS' + filepath_with_entitlements = '' + filepath_without_entitlements = 'FlutterMacOS.framework/Versions/A/FlutterMacOS' embed_codesign_configuration( - os.path.join(dst, 'entitlements.txt'), macos_filepath_with_entitlements + os.path.join(dst, 'entitlements.txt'), filepath_with_entitlements ) embed_codesign_configuration( os.path.join(dst, 'without_entitlements.txt'), - macos_filepath_without_entitlements + filepath_without_entitlements ) subprocess.check_call([ 'zip',