Generate MacOS framework with GN + Ninja. (flutter/engine#31903)

This commit is contained in:
godofredoc 2022-03-09 12:45:04 -08:00 committed by GitHub
parent 7a1440aa54
commit 517844bc57
3 changed files with 51 additions and 3 deletions

View File

@ -127,3 +127,12 @@ if (host_os == "win") {
]
}
}
# Archives Flutter Mac Artifacts
if (is_mac) {
group("macos_flutter_framework") {
deps = [
"//flutter/shell/platform/darwin/macos:macos_flutter_framework_archive",
]
}
}

View File

@ -42,6 +42,7 @@ template("zip_bundle") {
script = "//flutter/build/zip.py"
outputs = [ "$root_build_dir/zip_archives/${invoker.output}" ]
sources = []
forward_variables_from(invoker, [ "visibility" ])
deps = invoker.deps
args = [
@ -84,14 +85,18 @@ template("zip_bundle") {
template("zip_bundle_from_file") {
assert(defined(invoker.output), "output must be defined")
assert(defined(invoker.files), "files must be defined as a list of scopes")
action(target_name) {
forward_variables_from(invoker,
[
"visibility",
"deps",
])
script = "//flutter/build/zip.py"
outputs = [ "$root_build_dir/zip_archives/${invoker.output}" ]
sources = []
deps = invoker.deps
location_source_path = "$target_gen_dir/zip_bundle.txt"
write_file(location_source_path, invoker.files, "json")
args = [
"-o",
rebase_path(outputs[0]),

View File

@ -5,6 +5,7 @@
assert(is_mac)
import("//build/config/mac/mac_sdk.gni")
import("//flutter/build/zip_bundle.gni")
import("//flutter/shell/gpu/gpu.gni")
import("//flutter/shell/platform/darwin/common/framework_shared.gni")
import("//flutter/shell/platform/glfw/config.gni")
@ -273,7 +274,10 @@ copy("copy_license") {
action("_generate_symlinks") {
visibility = [ ":*" ]
script = "//build/config/mac/package_framework.py"
outputs = [ "$root_build_dir/$_flutter_framework_name.stamp" ]
outputs = [
"$root_build_dir/$_flutter_framework_name.stamp",
"$root_out_dir/$_flutter_framework_filename",
]
args = [
"--framework",
"$_flutter_framework_filename",
@ -317,3 +321,33 @@ if (build_glfw_shell) {
public_configs = [ "//flutter:config" ]
}
}
zip_bundle("zip_macos_flutter_framework") {
output = "FlutterMacOS.framework.zip"
visibility = [ ":*" ]
deps = [ ":_generate_symlinks" ]
files = [
{
source = "$root_out_dir/FlutterMacOS.framework"
destination = "FlutterMacOS.framework.zip"
},
]
}
zip_bundle("macos_flutter_framework_archive") {
output = "$full_platform_name/FlutterMacOS.framework.zip"
deps = [
":copy_framework_podspec",
":zip_macos_flutter_framework",
]
files = [
{
source = "$root_out_dir/zip_archives/FlutterMacOS.framework.zip"
destination = "FlutterMacOS.framework.zip"
},
{
source = "$root_out_dir/FlutterMacOS.podspec"
destination = "FlutterMacOS.podspec"
},
]
}