diff --git a/engine/src/flutter/build/archives/BUILD.gn b/engine/src/flutter/build/archives/BUILD.gn index 49097396468..ec41a860502 100644 --- a/engine/src/flutter/build/archives/BUILD.gn +++ b/engine/src/flutter/build/archives/BUILD.gn @@ -281,19 +281,8 @@ if (host_os == "win") { # Archives Flutter Mac Artifacts if (is_mac) { - generated_file("snapshot_entitlement_config") { - outputs = [ "$target_gen_dir/snapshot_entitlements.txt" ] - - data_keys = [ "snapshot_entitlement_file_path" ] - - deps = [ "//flutter/lib/snapshot:create_macos_gen_snapshots" ] - } - zip_bundle("archive_gen_snapshot") { - deps = [ - ":snapshot_entitlement_config", - "//flutter/lib/snapshot:create_macos_gen_snapshots", - ] + deps = [ "//flutter/lib/snapshot:create_macos_gen_snapshots" ] suffix = "-$flutter_runtime_mode" if (flutter_runtime_mode == "debug") { suffix = "" @@ -304,10 +293,6 @@ if (is_mac) { source = "$root_out_dir/gen_snapshot_$target_cpu" destination = "gen_snapshot_$target_cpu" }, - { - source = "$target_gen_dir/snapshot_entitlements.txt" - destination = "entitlements.txt" - }, ] } diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 5ef9d98cc0e..eacbee21539 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -290,9 +290,6 @@ if (host_os == "mac" && target_os == "mac") { sources = [ "${host_output_dir}/gen_snapshot" ] outputs = [ "${root_out_dir}/gen_snapshot_${target_cpu}" ] deps = [ "//third_party/dart/runtime/bin:gen_snapshot($host_toolchain)" ] - metadata = { - snapshot_entitlement_file_path = [ "gen_snapshot_{$target_cpu}" ] - } } } diff --git a/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py b/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py index 7bd1c6d0e8f..f586ce456ca 100755 --- a/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py +++ b/engine/src/flutter/sky/tools/create_macos_gen_snapshots.py @@ -67,7 +67,20 @@ def main(): zip_archive(dst) +def embed_codesign_configuration(config_path, contents): + with open(config_path, 'w') as f: + f.write('\n'.join(contents) + '\n') + + def zip_archive(dst): + snapshot_filepath_with_entitlements = [ + 'gen_snapshot_arm64', 'gen_snapshot_x64' + ] + + embed_codesign_configuration( + os.path.join(dst, 'entitlements.txt'), snapshot_filepath_with_entitlements + ) + subprocess.check_call([ 'zip', '-r',