[gn + codesign] move snapshot meta data to generators (flutter/engine#39726)

[gn + codesign] move snapshot meta data to generators
This commit is contained in:
Xilai Zhang 2023-02-27 16:06:43 -08:00 committed by GitHub
parent d2b6e2e0a6
commit 4bf5a04e84
3 changed files with 14 additions and 19 deletions

View File

@ -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"
},
]
}

View File

@ -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}" ]
}
}
}

View File

@ -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',