diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 618640efe53..bf08b11d865 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -26,6 +26,19 @@ group("generate_snapshot_bins") { } } +# Uses gen_snapshot to compile a Dart core platform snapshot. +# +# Inputs: +# * platform_strong.dill +# +# Outputs: +# * vm_snapshot_data.bin +# * vm_snapshot_instructions.bin +# * isolate_snapshot_data.bin +# * isolate_snapshot_instructions.bin +# +# See: `bin_to_linkable` rules below that build these outputs into linkable form +# See: https://github.com/flutter/flutter/wiki/Flutter-engine-operation-in-AOT-Mode compiled_action("generate_snapshot_bin") { if (target_cpu == "x86" && host_os == "linux") { # By default Dart will create a 32-bit gen_snapshot host binary if the target @@ -157,6 +170,9 @@ template("bin_to_coff") { } } +# Generates a linkable output file defining the specified symbol with the bytes +# from the binary file. Emits a COFF object file when targeting Windows, +# otherwise assembly. template("bin_to_linkable") { assert(defined(invoker.deps), "Must define deps") assert(defined(invoker.input), "Must define input binary file") @@ -207,6 +223,11 @@ bin_to_linkable("platform_strong_dill_linkable") { executable = false } +# Creates a `gen_snapshot` binary suffixed with the target platform. +# +# Builds gen_snapshot using the host toolchain then copies the resulting binary +# to `gen_snapshot_armv7` or `gen_snapshot_arm64` depending on the target +# platform. if (host_os == "mac" && (target_cpu == "arm" || target_cpu == "arm64")) { action("create_arm_gen_snapshot") { host_output_dir = get_label_info( @@ -261,6 +282,7 @@ source_set("snapshot") { get_target_outputs(":platform_strong_dill_linkable") } +# Compiles the Dart/Flutter core libraries to kernel bytecode. compile_platform("strong_platform") { single_root_scheme = "org-dartlang-sdk" single_root_base = rebase_path("../../../")