From 480b8230aad7a2793ba2de2e66d825d7e48de7cf Mon Sep 17 00:00:00 2001 From: Xilai Zhang Date: Mon, 18 Jul 2022 10:56:07 -0700 Subject: [PATCH] [gn + artifacts] embed Mac entitlement config in gen_snapshot.zip (flutter/engine#34702) --- engine/src/flutter/build/archives/BUILD.gn | 17 ++++++++++++++++- .../src/flutter/sky/tools/macos_snapshots.gni | 3 +++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/build/archives/BUILD.gn b/engine/src/flutter/build/archives/BUILD.gn index e09d101afc..9e688eb763 100644 --- a/engine/src/flutter/build/archives/BUILD.gn +++ b/engine/src/flutter/build/archives/BUILD.gn @@ -194,6 +194,14 @@ 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" ] + } + group("macos_flutter_framework") { deps = [ "//flutter/shell/platform/darwin/macos:macos_flutter_framework_archive", @@ -201,7 +209,10 @@ if (is_mac) { } zip_bundle("archive_gen_snapshot") { - deps = [ "//flutter/lib/snapshot:create_macos_gen_snapshots" ] + deps = [ + ":snapshot_entitlement_config", + "//flutter/lib/snapshot:create_macos_gen_snapshots", + ] suffix = "-$flutter_runtime_mode" if (flutter_runtime_mode == "debug") { suffix = "" @@ -212,6 +223,10 @@ 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/sky/tools/macos_snapshots.gni b/engine/src/flutter/sky/tools/macos_snapshots.gni index 105ff2dcfa..cc624c20bb 100644 --- a/engine/src/flutter/sky/tools/macos_snapshots.gni +++ b/engine/src/flutter/sky/tools/macos_snapshots.gni @@ -41,5 +41,8 @@ template("macos_gen_snapshots") { "--arch", invoker.arch, ] + metadata = { + snapshot_entitlement_file_path = [ "gen_snapshot_${invoker.arch}" ] + } } }