blob: 63684c9554dafb7dd08f9c3dbd28cbf961deb532 [file] [log] [blame]
# Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
# for details. 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/compiled_action.gni")
import("../build/dart_host_sdk_toolchain.gni")
_dart_root = get_path_info("..", "abspath")
# Template to generate entry points JSON file using dart_bootstrap tool.
# List of entry points is generated as a by-product while doing precompilation.
#
# This template expects the following arguments:
# - input: Name of the input dart script for precompilation.
# - output: Name of the output entry points JSON file.
# - extra_args: Extra arguments to pass to dart_bootstrap (optional).
#
template("generate_entry_points_json_with_dart_bootstrap") {
assert(defined(invoker.input), "Must define input dart script")
assert(defined(invoker.output), "Must define output json file")
extra_args = []
if (defined(invoker.extra_args)) {
extra_args += invoker.extra_args
}
compiled_action(target_name) {
# Printing precompiler entry points is folded into precompilation, so dart_bootstrap is invoked
# with correct arguments to generate app-aot snapshot.
input = invoker.input
output = invoker.output
tool = "$_dart_root/runtime/bin:dart_bootstrap"
inputs = [
input,
]
outputs = [
output,
]
args = [
"--print-precompiler-entry-points=" + rebase_path(output),
"--snapshot=" + rebase_path("$target_gen_dir/dummy.snapshot"),
"--snapshot-kind=app-aot",
"--use-blobs",
"--snapshot-kind=app-aot",
] + extra_args + [
rebase_path(input),
]
}
}
# Template to generate entry points JSON file using gen_snapshot tool.
# List of entry points is generated as a by-product while doing precompilation.
#
# This template expects the following arguments:
# - input: Name of the input dart script for precompilation.
# - output: Name of the output entry points JSON file.
# - extra_args: Extra arguments to pass to dart_bootstrap (optional).
# - extra_inputs: Extra input dependencies (optional).
#
template("generate_entry_points_json_with_gen_snapshot") {
assert(defined(invoker.input), "Must define input dart script")
assert(defined(invoker.output), "Must define output json file")
extra_args = []
if (defined(invoker.extra_args)) {
extra_args += invoker.extra_args
}
extra_inputs = []
if (defined(invoker.extra_inputs)) {
extra_inputs += invoker.extra_inputs
}
compiled_action(target_name) {
# Printing precompiler entry points is folded into precompilation, so gen_snapshot is invoked
# with correct arguments to generate app-aot snapshot.
input = invoker.input
output = invoker.output
tool = "$_dart_root/runtime/bin:gen_snapshot"
inputs = [
input,
] + extra_inputs
outputs = [
output,
]
args = [
"--print-precompiler-entry-points=" + rebase_path(output),
"--snapshot-kind=app-aot-blobs",
"--vm_snapshot_data=" + rebase_path("$target_gen_dir/dummy.vm_data.snapshot"),
"--vm_snapshot_instructions=" + rebase_path("$target_gen_dir/dummy.vm_instr.snapshot"),
"--isolate_snapshot_data=" + rebase_path("$target_gen_dir/dummy.isolate_data.snapshot"),
"--isolate_snapshot_instructions=" + rebase_path("$target_gen_dir/dummy.isolate_instr.snapshot"),
] + extra_args + [
rebase_path(input),
]
}
}
# Template to copy checked-in extra entry points JSON file.
#
# This template expects the following argument:
# - output: Target destination for the extra entry points JSON file.
#
template("copy_entry_points_extra_json") {
assert(defined(invoker.output), "Must define output json file")
copy(target_name) {
sources = [ "$_dart_root/pkg/vm/lib/transformations/type_flow/entry_points_extra.json" ]
outputs = [ invoker.output ]
}
}