blob: aa315b849a0c77df0a6fa54358e20de691c472c0 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/dart/dart_tool.gni")
import("//third_party/dart/utils/compile_platform.gni")
compile_platform("kernel_platform_files") {
single_root_scheme = "org-dartlang-sdk"
single_root_base = rebase_path("../../../../")
libraries_specification_uri =
"org-dartlang-sdk:///topaz/runtime/flutter_runner/kernel/libraries.json"
outputs = [
"$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill",
"$root_out_dir/flutter_runner_patched_sdk/vm_outline_strong.dill",
]
args = [
"--target=flutter_runner",
"dart:core",
]
}
declare_args() {
core_jit_cheat_target = ""
core_jit_cheat_trace = ""
}
template("core_snapshot") {
assert(defined(invoker.product),
"core_snapshot requires 'product' to be defined")
product_suffix = ""
if (invoker.product) {
product_suffix = "_product"
}
action(target_name) {
deps = gen_snapshot_deps
if (core_jit_cheat_target == "") {
platform_dill =
"$root_out_dir/flutter_runner_patched_sdk/platform_strong.dill"
deps += [ ":kernel_platform_files" ]
compilation_trace = "//topaz/runtime/flutter_runner/compilation_trace.txt"
} else {
# TODO(rmacnak): Remove core_jit_cheat_target.
platform_dill =
get_label_info(core_jit_cheat_target, "target_gen_dir") + "/" +
get_label_info(core_jit_cheat_target, "name") + "_kernel.dil"
deps += [ core_jit_cheat_target ]
compilation_trace = core_jit_cheat_trace
}
inputs = [
platform_dill,
compilation_trace,
]
vm_snapshot_data =
"$target_gen_dir/vm_isolate_snapshot${product_suffix}.bin"
vm_snapshot_instructions =
"$target_gen_dir/vm_snapshot_instructions${product_suffix}.bin"
isolate_snapshot_data =
"$target_gen_dir/isolate_snapshot${product_suffix}.bin"
isolate_snapshot_instructions =
"$target_gen_dir/isolate_snapshot_instructions${product_suffix}.bin"
outputs = [
vm_snapshot_data,
vm_snapshot_instructions,
isolate_snapshot_data,
isolate_snapshot_instructions,
]
if (invoker.product) {
script = gen_snapshot_product
} else {
script = gen_snapshot
}
args = [
# TODO(zra): remove this when the interpreter supports field guards.
"--no_use_field_guards",
# TODO(FL-117): Re-enable causal async stack traces when this issue is
# addressed.
"--no_causal_async_stacks",
"--enable_mirrors=false",
"--deterministic",
"--snapshot_kind=core-jit",
"--load_compilation_trace=" +
rebase_path(compilation_trace, root_build_dir),
"--vm_snapshot_data=" + rebase_path(vm_snapshot_data, root_build_dir),
"--vm_snapshot_instructions=" +
rebase_path(vm_snapshot_instructions, root_build_dir),
"--isolate_snapshot_data=" +
rebase_path(isolate_snapshot_data, root_build_dir),
"--isolate_snapshot_instructions=" +
rebase_path(isolate_snapshot_instructions, root_build_dir),
]
if (is_debug && !invoker.product) {
args += [ "--enable_asserts" ]
}
args += [ rebase_path(platform_dill) ]
}
}
core_snapshot("kernel_core_snapshot") {
product = false
}
core_snapshot("kernel_core_snapshot_product") {
product = true
}