From 9594d30d9d91e3c3c525a60268ccd581b9266e7a Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 13:00:13 -0800 Subject: [PATCH 1/8] Add gn targets for embedder and artifacts zip files. This is part of moving all the archive artifacts using GN. Bug: https://github.com/flutter/flutter/issues/81855 --- build/archives/BUILD.gn | 58 ++++++++++++++++++++++++++++++++ shell/platform/embedder/BUILD.gn | 19 +++++++++++ shell/platform/linux/BUILD.gn | 20 +++++++++++ 3 files changed, 97 insertions(+) create mode 100644 build/archives/BUILD.gn diff --git a/build/archives/BUILD.gn b/build/archives/BUILD.gn new file mode 100644 index 0000000000000..59167bf9b5a74 --- /dev/null +++ b/build/archives/BUILD.gn @@ -0,0 +1,58 @@ +import("//flutter/build/zip_bundle.gni") + +zip_bundle("artifacts") { + output = "artifacts.zip" + files = [ + { + source = "//third_party/icu/flutter/icudtl.dat" + destination = "icudtl.dat" + }, + { + source = "$root_out_dir/flutter_tester" + destination = "flutter_tester" + }, + { + source = "$root_out_dir/gen/flutter/lib/snapshot/isolate_snapshot.bin" + destination = "isolate_snapshot.bin" + }, + { + source = "$root_gen_dir/flutter/lib/snapshot/vm_isolate_snapshot.bin" + destination = "vm_isolate_snapshot.bin" + }, + { + source = "$root_gen_dir/frontend_server.dart.snapshot" + destination = "frontend_server.dart.snapshot" + }, + ] + deps = [ + "//flutter/shell/testing:testing", + "//flutter/lib/snapshot:generate_snapshot_bin", + "//flutter/flutter_frontend_server:frontend_server", + ] +} + + +group("embedder") { + deps = [ + "//flutter/shell/platform/embedder:archive", + ] +} + + +zip_bundle("flutter_patched_sdk") { + output = "flutter_patched_sdk.zip" + files = [ + { + source = "$root_out_dir/flutter_patched_sdk/vm_outline_strong.dill" + destination = "vm_outline_strong.dill" + }, + { + source = "$root_out_dir/flutter_patched_sdk/platform_strong.dill" + destination = "platform_strong.dill" + }, + ] + deps = [ + "//flutter/lib/snapshot:strong_platform", + ] +} + diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index b8bffc3a8d068..2c9fd5c968a8c 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/toolchain/clang.gni") +import("//flutter/build/zip_bundle.gni") import("//flutter/common/config.gni") import("//flutter/shell/gpu/gpu.gni") import("//flutter/shell/platform/embedder/embedder.gni") @@ -410,3 +411,21 @@ group("flutter_engine") { } } } + +zip_bundle("archive") { + output = "${host_os}-${target_cpu}-embedder" + files = [ + { + source = "$root_out_dir/flutter_embedder.h" + destination = "flutter_embedder.h" + }, + { + source = "$root_out_dir/libflutter_engine.so" + destination = "libflutter_engine.so" + }, + ] + deps = [ + "//flutter/shell/platform/embedder:copy_headers", + "//flutter/shell/platform/embedder:flutter_engine_library", + ] +} diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index 0c4b703683af9..9f4821e753c5f 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -4,6 +4,7 @@ assert(is_linux) +import("//flutter/build/zip_bundle.gni") import("//flutter/shell/platform/glfw/config.gni") import("//flutter/testing/testing.gni") @@ -244,3 +245,22 @@ copy("publish_headers_linux") { sources = _public_headers outputs = [ "$root_out_dir/flutter_linux/{{source_file_part}}" ] } + + +zip_bundle("flutter_gtk") { + output = "$host_os-$target_cpu-flutter-gtk.zip" + sources = get_target_outputs(":publish_headers_linux") + tmp_files = [] + foreach(source, sources) { + tmp_files += [{ + source = source + destination = rebase_path(source, "$root_build_dir") + }] + } + tmp_files += [{ + source = "$root_build_dir/libflutter_${host_os}_gtk.so" + destination = "libflutter_${host_os}_gtk.so" + }] + files = tmp_files + deps = [ ":publish_headers_linux", ":flutter_linux_gtk" ] +} From a1e741cf834de001c877db0669bff1aff1a0cefe Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 13:51:09 -0800 Subject: [PATCH 2/8] Format files. --- build/archives/BUILD.gn | 15 ++++----------- shell/platform/linux/BUILD.gn | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/build/archives/BUILD.gn b/build/archives/BUILD.gn index 59167bf9b5a74..669c0e08bb659 100644 --- a/build/archives/BUILD.gn +++ b/build/archives/BUILD.gn @@ -25,20 +25,16 @@ zip_bundle("artifacts") { }, ] deps = [ - "//flutter/shell/testing:testing", - "//flutter/lib/snapshot:generate_snapshot_bin", "//flutter/flutter_frontend_server:frontend_server", + "//flutter/lib/snapshot:generate_snapshot_bin", + "//flutter/shell/testing:testing", ] } - group("embedder") { - deps = [ - "//flutter/shell/platform/embedder:archive", - ] + deps = [ "//flutter/shell/platform/embedder:archive" ] } - zip_bundle("flutter_patched_sdk") { output = "flutter_patched_sdk.zip" files = [ @@ -51,8 +47,5 @@ zip_bundle("flutter_patched_sdk") { destination = "platform_strong.dill" }, ] - deps = [ - "//flutter/lib/snapshot:strong_platform", - ] + deps = [ "//flutter/lib/snapshot:strong_platform" ] } - diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index 9f4821e753c5f..bc7acf9995232 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -246,21 +246,27 @@ copy("publish_headers_linux") { outputs = [ "$root_out_dir/flutter_linux/{{source_file_part}}" ] } - zip_bundle("flutter_gtk") { output = "$host_os-$target_cpu-flutter-gtk.zip" sources = get_target_outputs(":publish_headers_linux") tmp_files = [] foreach(source, sources) { - tmp_files += [{ - source = source - destination = rebase_path(source, "$root_build_dir") - }] + tmp_files += [ + { + source = source + destination = rebase_path(source, "$root_build_dir") + }, + ] } - tmp_files += [{ - source = "$root_build_dir/libflutter_${host_os}_gtk.so" - destination = "libflutter_${host_os}_gtk.so" - }] + tmp_files += [ + { + source = "$root_build_dir/libflutter_${host_os}_gtk.so" + destination = "libflutter_${host_os}_gtk.so" + }, + ] files = tmp_files - deps = [ ":publish_headers_linux", ":flutter_linux_gtk" ] + deps = [ + ":flutter_linux_gtk", + ":publish_headers_linux", + ] } From b7e3210e9b8ea255f1fe89e7d2aabbcffe73d471 Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 15:40:02 -0800 Subject: [PATCH 3/8] Roll buildroot version. --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 86a8c81c750ff..79535a47c1cb5 100644 --- a/DEPS +++ b/DEPS @@ -104,7 +104,7 @@ allowed_hosts = [ ] deps = { - 'src': 'https://github.com/flutter/buildroot.git' + '@' + '4660f4a166979c64ff56f6b856b44ccc1dba5c63', + 'src': 'https://github.com/flutter/buildroot.git' + '@' + '6cd24973cdf055bea3aa1ec1a0c54f2ff9a3f192', # Fuchsia compatibility # From 7cd2a7007e404ec4a2ce031414665f01843b8df3 Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 16:38:42 -0800 Subject: [PATCH 4/8] Conditionally generate linux-embedder file. --- build/archives/BUILD.gn | 7 +++++-- shell/platform/embedder/BUILD.gn | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build/archives/BUILD.gn b/build/archives/BUILD.gn index 669c0e08bb659..8c656ec48ec36 100644 --- a/build/archives/BUILD.gn +++ b/build/archives/BUILD.gn @@ -31,8 +31,11 @@ zip_bundle("artifacts") { ] } -group("embedder") { - deps = [ "//flutter/shell/platform/embedder:archive" ] + +if (host_os == "linux") { + group("linux-embedder") { + deps = [ "//flutter/shell/platform/embedder:linux-embedder-archive" ] + } } zip_bundle("flutter_patched_sdk") { diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 2c9fd5c968a8c..ef1750b9eda2a 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -412,8 +412,9 @@ group("flutter_engine") { } } -zip_bundle("archive") { - output = "${host_os}-${target_cpu}-embedder" + +zip_bundle("linux-embedder-archive") { + output = "${host_os}-${target_cpu}/${host_os}-${target_cpu}-embedder" files = [ { source = "$root_out_dir/flutter_embedder.h" From a6b203a51da50a8743d65e43e46a71925ad5b077 Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 16:41:35 -0800 Subject: [PATCH 5/8] Format GN files. --- build/archives/BUILD.gn | 1 - shell/platform/embedder/BUILD.gn | 1 - 2 files changed, 2 deletions(-) diff --git a/build/archives/BUILD.gn b/build/archives/BUILD.gn index 8c656ec48ec36..a955d3ec4343f 100644 --- a/build/archives/BUILD.gn +++ b/build/archives/BUILD.gn @@ -31,7 +31,6 @@ zip_bundle("artifacts") { ] } - if (host_os == "linux") { group("linux-embedder") { deps = [ "//flutter/shell/platform/embedder:linux-embedder-archive" ] diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index ef1750b9eda2a..768941375ca5f 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -412,7 +412,6 @@ group("flutter_engine") { } } - zip_bundle("linux-embedder-archive") { output = "${host_os}-${target_cpu}/${host_os}-${target_cpu}-embedder" files = [ From 1a7abd0129cb6322b1282c846349959badf7e2b6 Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 16:59:59 -0800 Subject: [PATCH 6/8] Conditionally archive the linux-embedder. --- shell/platform/embedder/BUILD.gn | 34 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index 768941375ca5f..af065ab794aa8 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -412,20 +412,22 @@ group("flutter_engine") { } } -zip_bundle("linux-embedder-archive") { - output = "${host_os}-${target_cpu}/${host_os}-${target_cpu}-embedder" - files = [ - { - source = "$root_out_dir/flutter_embedder.h" - destination = "flutter_embedder.h" - }, - { - source = "$root_out_dir/libflutter_engine.so" - destination = "libflutter_engine.so" - }, - ] - deps = [ - "//flutter/shell/platform/embedder:copy_headers", - "//flutter/shell/platform/embedder:flutter_engine_library", - ] +if (host_os == "linux") { + zip_bundle("linux-embedder-archive") { + output = "${host_os}-${target_cpu}/${host_os}-${target_cpu}-embedder" + files = [ + { + source = "$root_out_dir/flutter_embedder.h" + destination = "flutter_embedder.h" + }, + { + source = "$root_out_dir/libflutter_engine.so" + destination = "libflutter_engine.so" + }, + ] + deps = [ + "//flutter/shell/platform/embedder:copy_headers", + "//flutter/shell/platform/embedder:flutter_engine_library", + ] + } } From 81473f0492e99cd213c19846f6cc62b710c0be16 Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Tue, 4 Jan 2022 18:22:58 -0800 Subject: [PATCH 7/8] Save artifacts in a host_cpu location. --- build/archives/BUILD.gn | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/build/archives/BUILD.gn b/build/archives/BUILD.gn index a955d3ec4343f..4acd89992d538 100644 --- a/build/archives/BUILD.gn +++ b/build/archives/BUILD.gn @@ -1,16 +1,12 @@ import("//flutter/build/zip_bundle.gni") zip_bundle("artifacts") { - output = "artifacts.zip" + output = "$host_os-$target_cpu/artifacts.zip" files = [ { source = "//third_party/icu/flutter/icudtl.dat" destination = "icudtl.dat" }, - { - source = "$root_out_dir/flutter_tester" - destination = "flutter_tester" - }, { source = "$root_out_dir/gen/flutter/lib/snapshot/isolate_snapshot.bin" destination = "isolate_snapshot.bin" @@ -24,6 +20,21 @@ zip_bundle("artifacts") { destination = "frontend_server.dart.snapshot" }, ] + if (host_os == "win") { + files += [ + { + source = "$root_out_dir/flutter_tester.exe" + destination = "flutter_tester" + }, + ] + } else { + files += [ + { + source = "$root_out_dir/flutter_tester" + destination = "flutter_tester" + }, + ] + } deps = [ "//flutter/flutter_frontend_server:frontend_server", "//flutter/lib/snapshot:generate_snapshot_bin", From 6e1a6e7a56a0012483e38c8639f0968b0972471b Mon Sep 17 00:00:00 2001 From: Godofredo Contreras Date: Wed, 5 Jan 2022 10:48:52 -0800 Subject: [PATCH 8/8] Move deps section to the top. --- build/archives/BUILD.gn | 12 ++++++------ shell/platform/embedder/BUILD.gn | 8 ++++---- shell/platform/linux/BUILD.gn | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/build/archives/BUILD.gn b/build/archives/BUILD.gn index 4acd89992d538..b7ffa219cdb35 100644 --- a/build/archives/BUILD.gn +++ b/build/archives/BUILD.gn @@ -2,6 +2,11 @@ import("//flutter/build/zip_bundle.gni") zip_bundle("artifacts") { output = "$host_os-$target_cpu/artifacts.zip" + deps = [ + "//flutter/flutter_frontend_server:frontend_server", + "//flutter/lib/snapshot:generate_snapshot_bin", + "//flutter/shell/testing:testing", + ] files = [ { source = "//third_party/icu/flutter/icudtl.dat" @@ -35,11 +40,6 @@ zip_bundle("artifacts") { }, ] } - deps = [ - "//flutter/flutter_frontend_server:frontend_server", - "//flutter/lib/snapshot:generate_snapshot_bin", - "//flutter/shell/testing:testing", - ] } if (host_os == "linux") { @@ -50,6 +50,7 @@ if (host_os == "linux") { zip_bundle("flutter_patched_sdk") { output = "flutter_patched_sdk.zip" + deps = [ "//flutter/lib/snapshot:strong_platform" ] files = [ { source = "$root_out_dir/flutter_patched_sdk/vm_outline_strong.dill" @@ -60,5 +61,4 @@ zip_bundle("flutter_patched_sdk") { destination = "platform_strong.dill" }, ] - deps = [ "//flutter/lib/snapshot:strong_platform" ] } diff --git a/shell/platform/embedder/BUILD.gn b/shell/platform/embedder/BUILD.gn index af065ab794aa8..622432d2c11b1 100644 --- a/shell/platform/embedder/BUILD.gn +++ b/shell/platform/embedder/BUILD.gn @@ -415,6 +415,10 @@ group("flutter_engine") { if (host_os == "linux") { zip_bundle("linux-embedder-archive") { output = "${host_os}-${target_cpu}/${host_os}-${target_cpu}-embedder" + deps = [ + "//flutter/shell/platform/embedder:copy_headers", + "//flutter/shell/platform/embedder:flutter_engine_library", + ] files = [ { source = "$root_out_dir/flutter_embedder.h" @@ -425,9 +429,5 @@ if (host_os == "linux") { destination = "libflutter_engine.so" }, ] - deps = [ - "//flutter/shell/platform/embedder:copy_headers", - "//flutter/shell/platform/embedder:flutter_engine_library", - ] } } diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index bc7acf9995232..403d484fa0543 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -248,6 +248,10 @@ copy("publish_headers_linux") { zip_bundle("flutter_gtk") { output = "$host_os-$target_cpu-flutter-gtk.zip" + deps = [ + ":flutter_linux_gtk", + ":publish_headers_linux", + ] sources = get_target_outputs(":publish_headers_linux") tmp_files = [] foreach(source, sources) { @@ -265,8 +269,4 @@ zip_bundle("flutter_gtk") { }, ] files = tmp_files - deps = [ - ":flutter_linux_gtk", - ":publish_headers_linux", - ] }