From 864119c45cf5265eeb194a5f85186da4a52c6214 Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Thu, 25 Aug 2022 10:26:02 -0700 Subject: [PATCH 1/6] embed codesign config in macos framework --- sky/tools/create_macos_framework.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index 7f6200070391e..ece3bcd8f45b1 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -96,6 +96,9 @@ def main(): return 1 process_framework(dst, args, fat_framework, fat_framework_binary) +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: @@ -113,9 +116,22 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): subprocess.check_call(["strip", "-x", "-S", fat_framework_binary]) + macos_filepath_with_entitlements = '' + macos_filepath_without_entitlements = 'FlutterMacOS.framework.zip/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 + ) + # Zip FlutterMacOS.framework. subprocess.check_call([ - 'zip', '-r', 'FlutterMacOS.framework.zip', 'FlutterMacOS.framework' + 'zip', '-r', 'FlutterMacOS.framework.zip', 'FlutterMacOS.framework', 'entitlements.txt', + 'without_entitlements.txt', ], cwd=dst) From 2198a078017d569f18bf6854498083fbf76d4ea2 Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Thu, 25 Aug 2022 10:27:47 -0700 Subject: [PATCH 2/6] format files --- sky/tools/create_macos_framework.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index 3b9bff38664ce..d12e4a3ed26fc 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -96,10 +96,12 @@ def main(): return 1 process_framework(dst, args, fat_framework, fat_framework_binary) + 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' @@ -131,7 +133,11 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): # Zip FlutterMacOS.framework. subprocess.check_call([ - 'zip', '-r', 'FlutterMacOS.framework.zip', 'FlutterMacOS.framework', 'entitlements.txt', + 'zip', + '-r', + 'FlutterMacOS.framework.zip', + 'FlutterMacOS.framework', + 'entitlements.txt', 'without_entitlements.txt', ], cwd=dst) From a8deeed9847fa29e7324d25a43eb8e29712c7428 Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Thu, 25 Aug 2022 14:42:19 -0700 Subject: [PATCH 3/6] update path --- sky/tools/create_macos_framework.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index d12e4a3ed26fc..b982b0268b312 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -120,7 +120,7 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): subprocess.check_call(["strip", "-x", "-S", fat_framework_binary]) macos_filepath_with_entitlements = '' - macos_filepath_without_entitlements = 'FlutterMacOS.framework.zip/Versions/A/FlutterMacOS' + macos_filepath_without_entitlements = 'FlutterMacOS.framework/Versions/A/FlutterMacOS' embed_codesign_configuration( os.path.join(dst, 'entitlements.txt'), macos_filepath_with_entitlements From e459033ac30c09446bceeb5ff11c035006ca495f Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Thu, 16 Feb 2023 14:48:12 -0800 Subject: [PATCH 4/6] y flag for outer layer zip --- sky/tools/create_macos_framework.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index bcca07d7f760a..2452cd1f8fcb7 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -173,6 +173,7 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): subprocess.check_call([ 'zip', '-r', + '-y', 'FlutterMacOS.framework.zip', 'FlutterMacOS.framework', 'entitlements.txt', From a5651548f61146def2ef889ae740a1f78f73e3d3 Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Fri, 17 Feb 2023 11:18:06 -0800 Subject: [PATCH 5/6] simplify structure --- sky/tools/create_macos_framework.py | 40 ++++++++++------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index 2452cd1f8fcb7..1b566d06dc6a7 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -151,36 +151,24 @@ 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' + 'FlutterMacOS.framework', + 'entitlements.txt', + 'without_entitlements.txt', ], cwd=dst) - 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 - ) - - # Zip FlutterMacOS.framework. - subprocess.check_call([ - 'zip', - '-r', - '-y', - 'FlutterMacOS.framework.zip', - 'FlutterMacOS.framework', - 'entitlements.txt', - 'without_entitlements.txt', - ], - cwd=dst) - - if __name__ == '__main__': sys.exit(main()) From f55c612fc14dfd6ae648a3bfe2109607dab94911 Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Fri, 17 Feb 2023 11:18:52 -0800 Subject: [PATCH 6/6] format files --- sky/tools/create_macos_framework.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sky/tools/create_macos_framework.py b/sky/tools/create_macos_framework.py index 1b566d06dc6a7..6da93d425789a 100755 --- a/sky/tools/create_macos_framework.py +++ b/sky/tools/create_macos_framework.py @@ -163,12 +163,16 @@ def process_framework(dst, args, fat_framework, fat_framework_binary): macos_filepath_without_entitlements ) subprocess.check_call([ - 'zip', '-r', '-y', 'FlutterMacOS.framework.zip', + 'zip', + '-r', + '-y', + 'FlutterMacOS.framework.zip', 'FlutterMacOS.framework', 'entitlements.txt', 'without_entitlements.txt', ], cwd=dst) + if __name__ == '__main__': sys.exit(main())