diff --git a/build/dart/dart_action.gni b/build/dart/dart_action.gni index 2058f0334c3..c357aad4d99 100644 --- a/build/dart/dart_action.gni +++ b/build/dart/dart_action.gni @@ -288,6 +288,10 @@ template("_built_tool_action") { # script: # The un-rebased path to the Dart script. # +# dfe (optional): +# Sets the DFE file used by Dart. If not set the VM will attempt to load it +# from a snapshot, or fall back on its built-in kernel. +# # vm_args (optional): # Arguments to pass to the Dart VM. # @@ -323,6 +327,17 @@ template("dart_action") { "visibility", "vm_args", ]) + + # Dart has an implicit dependency on the kernel service so unless DFE is + # passed, we need to add this dep. + if (defined(invoker.dfe)) { + vm_args += [ "--dfe=" + rebase_path(invoker.dfe) ] + } else { + if (!defined(invoker.deps)) { + deps = [] + } + deps += [ "$_dart_root/utils/kernel-service:kernel-service" ] + } } } else { prebuilt_dart_action(target_name) { diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni index 7d981bd728a..81ec5eed094 100644 --- a/utils/application_snapshot.gni +++ b/utils/application_snapshot.gni @@ -134,6 +134,7 @@ template("_application_snapshot") { args += [ rebase_path(main_dart) ] } + # Create a snapshot from kernel built above. dart_action(target_name) { deps = extra_deps + [ ":${target_name}_dill" ] depfile = "$output.d" @@ -144,6 +145,10 @@ template("_application_snapshot") { outputs = [ output ] + # Explicitly set DFE so Dart doesn't implicitly depend on the kernel service + # snapshot (creating a circular dep. for kernel-service_snapshot). + dfe = "$_dart_root/pkg/vm/bin/kernel_service.dart" + abs_depfile = rebase_path(depfile) abs_output = rebase_path(output, root_build_dir)