1
0
mirror of https://github.com/dart-lang/sdk synced 2024-07-05 09:20:04 +00:00

[GN] Uses dart_action.gni instead of compiled_action.gni.

This avoids conflicts with client repos that have a file
//build/compiled_action.gni with something different in them.

Change-Id: I133f66b0989bcb547cb8eed8710a88e2c1384bd7
Reviewed-on: https://dart-review.googlesource.com/53440
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Zach Anderson 2018-05-03 21:07:13 +00:00 committed by commit-bot@chromium.org
parent 4b89ba24fb
commit 4877587346
20 changed files with 432 additions and 516 deletions

View File

@ -2,7 +2,7 @@
# 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/dart_host_sdk_toolchain.gni")
import("build/dart/dart_host_sdk_toolchain.gni")
targetting_fuchsia = target_os == "fuchsia"

View File

@ -1,191 +0,0 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file introduces two related templates that act like action and
# action_foreach but instead of running a Python script, it will compile a
# given tool in the host toolchain and run that (either once or over the list
# of inputs, depending on the variant).
#
# Parameters
#
# tool (required)
# [label] Label of the tool to run. This should be an executable, and
# this label should not include a toolchain (anything in parens). The
# host compile of this tool will be used.
#
# outputs (required)
# [list of files] Like the outputs of action (if using "compiled_action",
# this would be just the list of outputs), or action_foreach (if using
# "compiled_action_foreach", this would contain source expansions mapping
# input to output files).
#
# args (required)
# [list of strings] Same meaning as action/action_foreach.
#
# inputs (optional)
# Files the binary takes as input. The step will be re-run whenever any
# of these change. If inputs is empty, the step will run only when the
# binary itself changes.
#
# visibility
# deps
# args (all optional)
# Same meaning as action/action_foreach.
#
#
# Example of usage:
#
# compiled_action("run_my_tool") {
# tool = "//tools/something:mytool"
# outputs = [
# "$target_gen_dir/mysource.cc",
# "$target_gen_dir/mysource.h",
# ]
#
# # The tool takes this input.
# inputs = [ "my_input_file.idl" ]
#
# # In this case, the tool takes as arguments the input file and the output
# # build dir (both relative to the "cd" that the script will be run in)
# # and will produce the output files listed above.
# args = [
# rebase_path("my_input_file.idl", root_build_dir),
# "--output-dir", rebase_path(target_gen_dir, root_build_dir),
# ]
# }
#
# You would typically declare your tool like this:
# if (host_toolchain == current_toolchain) {
# executable("mytool") {
# ...
# }
# }
# The if statement around the executable is optional. That says "I only care
# about this target in the host toolchain". Usually this is what you want, and
# saves unnecessarily compiling your tool for the target platform. But if you
# need a target build of your tool as well, just leave off the if statement.
import("dart_host_sdk_toolchain.gni")
if (host_os == "win") {
_host_executable_suffix = ".exe"
} else {
_host_executable_suffix = ""
}
_dart_root = get_path_info("..", "abspath")
template("compiled_action") {
assert(defined(invoker.tool), "tool must be defined for $target_name")
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
assert(!defined(invoker.sources),
"compiled_action doesn't take a sources arg. Use inputs instead.")
action(target_name) {
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
script = "$_dart_root/build/gn_run_binary.py"
if (defined(invoker.inputs)) {
inputs = invoker.inputs
} else {
inputs = []
}
outputs = invoker.outputs
# Constuct the host toolchain version of the tool.
host_tool = invoker.tool + "($dart_host_toolchain)"
# Get the path to the executable. Currently, this assumes that the tool
# does not specify output_name so that the target name is the name to use.
# If that's not the case, we'll need another argument to the script to
# specify this, since we can't know what the output name is (it might be in
# another file not processed yet).
host_executable =
get_label_info(host_tool, "root_out_dir") + "/" +
get_label_info(host_tool, "name") + _host_executable_suffix
# Add the executable itself as an input.
inputs += [ host_executable ]
deps = [
host_tool,
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.depfile)) {
depfile = invoker.depfile
}
# The script takes as arguments the binary to run, and then the arguments
# to pass it.
args = [
"compiled_action",
rebase_path(host_executable, root_build_dir),
] + invoker.args
}
}
template("compiled_action_foreach") {
assert(defined(invoker.sources), "sources must be defined for $target_name")
assert(defined(invoker.tool), "tool must be defined for $target_name")
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
action_foreach(target_name) {
# Otherwise this is a standalone action, define visibility if requested.
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
script = "$_dart_root/build/gn_run_binary.py"
sources = invoker.sources
if (defined(invoker.inputs)) {
inputs = invoker.inputs
} else {
inputs = []
}
outputs = invoker.outputs
# Constuct the host toolchain version of the tool.
host_tool = invoker.tool + "($dart_host_toolchain)"
# Get the path to the executable. Currently, this assumes that the tool
# does not specify output_name so that the target name is the name to use.
# If that's not the case, we'll need another argument to the script to
# specify this, since we can't know what the output name is (it might be in
# another file not processed yet).
host_executable =
get_label_info(host_tool, "root_out_dir") + "/" +
get_label_info(host_tool, "name") + _host_executable_suffix
# Add the executable itself as an input.
inputs += [ host_executable ]
deps = [
host_tool,
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.depfile)) {
depfile = invoker.depfile
}
# The script takes as arguments the binary to run, and then the arguments
# to pass it.
args = [
"compiled_action",
rebase_path(host_executable, root_build_dir),
] + invoker.args
}
}

367
build/dart/dart_action.gni Normal file
View File

@ -0,0 +1,367 @@
# 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("../executable_suffix.gni")
import("dart_host_sdk_toolchain.gni")
import("prebuilt_dart_sdk.gni")
# This file defines templates for running and compiling Dart code during
# Dart's build.
#
# - prebuilt_dart_action()
# Runs Dart scripts using the downloaded prebuilt Dart SDK if there is one,
# and a built dart_bootstrap otherwise. This is the preferred method of
# running Dart code during the build as it is much faster than using
# dart_action() in debug and cross builds. However, prebuilt_dart_action()
# should *not* be used to generate snapshots.
#
# - dart_action()
# Runs Dart scripts using the binary built for runtime/bin:dart using the
# host toolchain. It should only be used when an artifact agreeing exactly
# with the version of the Dart VM being built must be produced, for example
# an App-JIT snapshot. This will be slow in Debug builds, and very slow in
# cross builds.
#
# - dart_bootstrap_action()
# Ditto, but uses runtime/bin:dart_bootstrap.
#
# - gen_snapshot_action()
# Runs the binary built for runtime/bin:gen_snapshot using the host
# toolchain. It should only be used when an artifact agreeing exactly
# with the version of the Dart VM being built must be produced.
# This assigns _dart_root the GN absolute path of the Dart repo. For example,
# in a Dart checkout, this will be "//". In a client repo it might be
# "//third_party/dart".
_dart_root = get_path_info("../..", "abspath")
template("_compiled_action") {
assert(defined(invoker.tool), "tool must be defined for $target_name")
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
action(target_name) {
if (defined(invoker.visibility)) {
visibility = invoker.visibility
}
script = "$_dart_root/build/gn_run_binary.py"
if (defined(invoker.inputs)) {
inputs = invoker.inputs
} else {
inputs = []
}
outputs = invoker.outputs
# Construct the host toolchain version of the tool.
host_tool = invoker.tool + "($dart_host_toolchain)"
# Get the path to the executable. Currently, this assumes that the tool
# does not specify output_name so that the target name is the name to use.
# If that's not the case, we'll need another argument to the script to
# specify this, since we can't know what the output name is (it might be in
# another file not processed yet).
host_executable =
get_label_info(host_tool, "root_out_dir") + "/" +
get_label_info(host_tool, "name") + executable_suffix
# Add the executable itself as an input.
inputs += [ host_executable ]
deps = [
host_tool,
]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.depfile)) {
depfile = invoker.depfile
}
# The "compiled_action" argument to gn_run_binary.py indicates that
# it will exit with a non-zero status when the target program does.
args = [
"compiled_action",
rebase_path(host_executable, root_build_dir),
] + invoker.args
}
}
# A template for running Dart scripts during the build using the prebuilt Dart
# SDK. This should *not* be used for generating snapshots. It uses the dart
# binary from the prebuilt Dart SDK if one is available, and dart_bootstrap
# otherwise.
#
# Parameters:
# script:
# The un-rebased path to the Dart script.
#
# vm_args (optional):
# Arguments to pass to the Dart VM.
#
# args (optional):
# The arguments to pass to the Dart script.
#
# packages (optional):
# The un-rebased path to the .packages file.
#
# Forwarded to action() with the usual meaning:
# depfile
# deps
# inputs
# outputs
# visibility
template("prebuilt_dart_action") {
assert(defined(invoker.script), "script must be defined for $target_name")
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
assert(!defined(invoker.sources),
"prebuilt_dart_action doesn't take a sources arg. Use inputs instead.")
vm_args = []
if (defined(invoker.vm_args)) {
vm_args += invoker.vm_args
}
if (prebuilt_dart_exe_works) {
action(target_name) {
forward_variables_from(invoker, [
"inputs",
"outputs",
"deps",
"visibility",
"depfile",
])
script = "$_dart_root/build/gn_run_binary.py"
prebuilt_dart_binary =
"$_dart_root/tools/sdks/$host_os/dart-sdk/bin/dart$executable_suffix"
inputs += [ invoker.script ]
if (defined(invoker.packages)) {
inputs += [ invoker.packages ]
}
args = [
"compiled_action",
rebase_path(prebuilt_dart_binary),
] + vm_args
if (defined(invoker.packages)) {
args += [
"--packages=" + rebase_path(invoker.packages),
]
}
args += [ rebase_path(invoker.script) ] + invoker.args
}
} else {
_compiled_action(target_name) {
forward_variables_from(invoker, [
"inputs",
"outputs",
"deps",
"visibility",
"depfile",
])
inputs += [ invoker.script ]
if (defined(invoker.packages)) {
inputs += [ invoker.packages ]
}
tool = "$_dart_root/runtime/bin:dart_bootstrap"
args = vm_args
if (defined(invoker.packages)) {
args += [
"--packages=" + rebase_path(invoker.packages),
]
}
args += [ rebase_path(invoker.script) ] + invoker.args
}
}
}
# This template runs the specified tool produced by the in-progress build.
#
# Parameters:
# tool:
# The target of the tool to run.
#
# script (optional):
# The un-rebased path to the Dart script.
#
# vm_args (optional):
# Arguments to pass to the Dart VM.
#
# args (optional):
# The arguments to pass to the Dart script.
#
# packages (optional):
# The un-rebased path to the .packages file.
#
# Forwarded to action() with the usual meaning:
# depfile
# deps
# inputs
# outputs
# visibility
template("_built_tool_action") {
assert(defined(invoker.tool), "tool must be defined for $target_name")
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
assert(!defined(invoker.sources),
"sources arg not supported for $target_name. Use inputs instead.")
vm_args = []
if (defined(invoker.vm_args)) {
vm_args += invoker.vm_args
}
_compiled_action(target_name) {
forward_variables_from(invoker, [
"depfile",
"deps",
"inputs",
"outputs",
"tool",
"visibility",
])
if (!defined(invoker.inputs)) {
inputs = []
}
if (defined(invoker.script)) {
inputs += [ invoker.script ]
}
if (defined(invoker.packages)) {
inputs += [ invoker.packages ]
}
args = vm_args
if (defined(invoker.packages)) {
args += [ "--packages=" + rebase_path(invoker.packages) ]
}
if (defined(invoker.script)) {
args += [ rebase_path(invoker.script) ]
}
args += invoker.args
}
}
# This template runs the Dart VM produced by the in-progress build.
#
# Parameters:
# script:
# The un-rebased path to the Dart script.
#
# vm_args (optional):
# Arguments to pass to the Dart VM.
#
# args (optional):
# The arguments to pass to the Dart script.
#
# packages (optional):
# The un-rebased path to the .packages file.
#
# Forwarded to action() with the usual meaning:
# depfile
# deps
# inputs
# outputs
# visibility
template("dart_action") {
assert(defined(invoker.script), "script must be defined for $target_name")
_built_tool_action(target_name) {
tool = "$_dart_root/runtime/bin:dart"
forward_variables_from(invoker, [
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"script",
"tool",
"visibility",
"vm_args",
])
}
}
# This template runs the dart_bootstrap produced by the in-progress build.
#
# Parameters:
# script:
# The un-rebased path to the Dart script.
#
# vm_args (optional):
# Arguments to pass to the Dart VM.
#
# args (optional):
# The arguments to pass to the Dart script.
#
# packages (optional):
# The un-rebased path to the .packages file.
#
# Forwarded to action() with the usual meaning:
# depfile
# deps
# inputs
# outputs
# visibility
template("dart_bootstrap_action") {
assert(defined(invoker.script), "script must be defined for $target_name")
_built_tool_action(target_name) {
tool = "$_dart_root/runtime/bin:dart_bootstrap"
forward_variables_from(invoker, [
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"script",
"tool",
"visibility",
"vm_args",
])
}
}
# This template runs the gen_snapshot produced by the in-progress build.
#
# Parameters:
# vm_args (optional):
# Arguments to pass to the Dart VM.
#
# args (optional):
# The arguments to pass to the Dart script.
#
# packages (optional):
# The un-rebased path to the .packages file.
#
# Forwarded to action() with the usual meaning:
# depfile
# deps
# inputs
# outputs
# visibility
template("gen_snapshot_action") {
assert(!defined(invoker.script),
"script must not be defined for $target_name. If there is a script use args instead.")
_built_tool_action(target_name) {
tool = "$_dart_root/runtime/bin:gen_snapshot"
forward_variables_from(invoker, [
"args",
"depfile",
"deps",
"inputs",
"outputs",
"packages",
"tool",
"visibility",
"vm_args",
])
}
}

View File

@ -2,14 +2,15 @@
# 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("executable_suffix.gni")
import("../executable_suffix.gni")
_dart_root = rebase_path("..")
_dart_root = rebase_path("../..")
_prebuilt_dart_exe = "$_dart_root/tools/sdks/$host_os/dart-sdk/bin/dart$executable_suffix"
# Our gn_run_binary swallows output unless there is an error.
_prebuilt_dart_exe_trial = exec_script("gn_run_binary.py",
# When the first argument is "exec_script", gn_run_binary.py always exits with
# status 0, but gives non-empty output when the command it is given fails.
_prebuilt_dart_exe_trial = exec_script("../gn_run_binary.py",
["exec_script", _prebuilt_dart_exe, "--version"], "string")
if (_prebuilt_dart_exe_trial == "") {
prebuilt_dart_exe_works = true

View File

@ -1,92 +0,0 @@
# 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("compiled_action.gni")
import("executable_suffix.gni")
import("prebuilt_dart_sdk.gni")
_dart_root = get_path_info("..", "abspath")
# A template for running Dart scripts during the build. This should *not* be
# used for generating snapshots. It uses the dart binary from the prebuilt
# Dart SDK if one is available, and dart_bootstrap otherwise.
#
# Parameters:
# script:
# The un-rebased path to the Dart script.
#
# args:
# The arguments to pass to the Dart script.
# packages (optional):
# The un-rebased path to the .packages file.
#
# Forwarded to action() with the usual meaning:
# depfile
# deps
# inputs
# outputs
# visibility
template("dart_action") {
assert(defined(invoker.script), "script must be defined for $target_name")
assert(defined(invoker.outputs), "outputs must be defined for $target_name")
assert(defined(invoker.args), "args must be defined for $target_name")
assert(!defined(invoker.sources),
"dart_action doesn't take a sources arg. Use inputs instead.")
if (prebuilt_dart_exe_works) {
action(target_name) {
forward_variables_from(invoker, [
"inputs",
"outputs",
"deps",
"visibility",
"depfile",
])
script = "$_dart_root/build/gn_run_binary.py"
prebuilt_dart_binary =
"$_dart_root/tools/sdks/$host_os/dart-sdk/bin/dart$executable_suffix"
inputs += [ invoker.script ]
if (defined(invoker.packages)) {
inputs += [ invoker.packages ]
}
args = [
"compiled_action",
rebase_path(prebuilt_dart_binary),
]
if (defined(invoker.packages)) {
args += [
"--packages=" + rebase_path(invoker.packages),
]
}
args += [ rebase_path(invoker.script) ] + invoker.args
}
} else {
compiled_action(target_name) {
forward_variables_from(invoker, [
"inputs",
"outputs",
"deps",
"visibility",
"depfile",
])
inputs += [ invoker.script ]
if (defined(invoker.packages)) {
inputs += [ invoker.packages ]
}
tool = "runtime/bin:dart_bootstrap"
args = []
if (defined(invoker.packages)) {
args += [
"--packages=" + rebase_path(invoker.packages),
]
}
args += [ rebase_path(invoker.script) ] + invoker.args
}
}
}

View File

@ -2,7 +2,7 @@
# 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/dart_host_sdk_toolchain.gni")
import("../build/dart/dart_host_sdk_toolchain.gni")
import("runtime_args.gni")
config("dart_public_config") {

View File

@ -2,7 +2,7 @@
# 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/dart_action.gni")
import("../../sdk/lib/_http/http_sources.gni")
import("../../sdk/lib/io/io_sources.gni")
import("../../sdk/lib/cli/cli_sources.gni")
@ -651,7 +651,7 @@ dart_io("standalone_dart_io") {
extra_sources = []
}
compiled_action("generate_snapshot_bin") {
gen_snapshot_action("generate_snapshot_bin") {
vm_snapshot_data = "$target_gen_dir/vm_snapshot_data.bin"
vm_snapshot_instructions = "$target_gen_dir/vm_snapshot_instructions.bin"
isolate_snapshot_data = "$target_gen_dir/isolate_snapshot_data.bin"
@ -665,7 +665,6 @@ compiled_action("generate_snapshot_bin") {
isolate_snapshot_data,
isolate_snapshot_instructions,
]
tool = ":gen_snapshot"
args = [
"--deterministic",
"--snapshot_kind=" + dart_core_snapshot_kind,
@ -1071,101 +1070,6 @@ dart_executable("dart_bootstrap") {
]
}
if (is_fuchsia) {
hello_fuchsia_source = rebase_path("../tests/vm/dart/hello_fuchsia_test.dart")
copy("hello_fuchsia") {
sources = [
hello_fuchsia_source,
]
outputs = [
"$root_out_dir/hello_fuchsia.dart",
]
}
hello_fuchsia_assembly = "$target_gen_dir/hello_fuchsia.S"
compiled_action("hello_fuchsia_assembly") {
inputs = [
hello_fuchsia_source,
]
outputs = [
hello_fuchsia_assembly,
]
tool = ":dart_bootstrap"
args = [
"--snapshot-kind=app-aot",
"--snapshot=" + rebase_path(hello_fuchsia_assembly),
hello_fuchsia_source,
]
}
shared_library("hello_fuchsia_dylib") {
deps = [
":hello_fuchsia_assembly",
]
sources = [
hello_fuchsia_assembly,
]
cflags = [
"-nostdlib",
"-nostartfiles",
]
output_name = "hello_fuchsia"
}
# Uncomment after https://fuchsia-review.googlesource.com/#/c/build/+/37541/
# lands.
# copy("copy_hello_fuchsia_dylib") {
# sources = [
# get_label_info(":hello_fuchsia_lib($shlib_toolchain)", "root_out_dir") +
# "/libhello_fuchsia.so",
# ]
# outputs = [
# "$root_build_dir/{{source_file_part}}",
# ]
# deps = [
# ":hello_fuchsia_dylib($shlib_toolchain)",
# ]
# }
import("//build/package.gni")
package("package") {
deprecated_system_image = true
package_name = "dart"
deps = [
":dart",
":dart_precompiled_runtime",
]
binaries = [
{
name = "dart"
},
{
name = "dart_precompiled_runtime"
},
]
}
package("dart_tests") {
deprecated_system_image = true
deps = [
":hello_fuchsia",
]
binaries = [
{
name = "hello_fuchsia.dart"
},
]
}
}
executable("process_test") {
sources = [
"process_test.cc",

View File

@ -2,9 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("../../build/dart_host_sdk_toolchain.gni")
import("../../build/dart/dart_host_sdk_toolchain.gni")
import("../../build/dart/prebuilt_dart_sdk.gni")
import("../../build/executable_suffix.gni")
import("../../build/prebuilt_dart_sdk.gni")
import("observatory_sources.gni")
# Construct arguments to the observatory tool for finding pub.

View File

@ -3,7 +3,6 @@
# BSD-style license that can be found in the LICENSE file.
import("../../build/executable_suffix.gni")
import("../../build/prebuilt_dart_sdk.gni")
import("../../sdk/lib/async/async_sources.gni")
import("../../sdk/lib/collection/collection_sources.gni")
import("../../sdk/lib/convert/convert_sources.gni")

View File

@ -13,7 +13,7 @@
# or ":copy_libraries" may delete/overwrite your addition, and the build will
# fail.
import("../build/copy_tree.gni")
import("copy_tree.gni")
declare_args() {
# Build a SDK with less stuff. It excludes dart2js, ddc, and web libraries.

View File

@ -2,7 +2,7 @@
# 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/dart_action.gni")
_dart_root = get_path_info("..", "abspath")
@ -18,9 +18,9 @@ declare_args() {
template("application_snapshot") {
assert(defined(invoker.main_dart), "Must specify 'main_dart'")
assert(defined(invoker.training_args), "Must specify 'training_args'")
vm_args = []
snapshot_vm_args = []
if (defined(invoker.vm_args)) {
vm_args = invoker.vm_args
snapshot_vm_args = invoker.vm_args
}
main_dart = invoker.main_dart
training_args = invoker.training_args
@ -45,14 +45,13 @@ template("application_snapshot") {
if (defined(invoker.output)) {
output = invoker.output
}
compiled_action(target_name) {
tool = "$_dart_root/runtime/bin:dart"
dart_action(target_name) {
deps = extra_deps
depfile = "$output.d"
main_file = rebase_path(main_dart)
script = main_dart
inputs = extra_inputs + [ main_file ]
inputs = extra_inputs
outputs = [
output,
@ -61,24 +60,22 @@ template("application_snapshot") {
abs_depfile = rebase_path(depfile)
abs_output = rebase_path(output, root_build_dir)
args = [
vm_args = [
"--deterministic",
"--packages=$dot_packages",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
] + vm_args
] + snapshot_vm_args
if (dart_snapshot_kind == "script") {
args += [
vm_args += [
"--snapshot-kind=script",
main_file,
]
assert(training_args != "", "Ignoring unused argument")
args = []
} else if (dart_snapshot_kind == "app-jit") {
args += [
"--snapshot-kind=app-jit",
main_file,
] + training_args
vm_args += [ "--snapshot-kind=app-jit" ]
args = training_args
} else {
assert(false, "Bad dart_snapshot_kind: $dart_snapshot_kind")
}
@ -87,9 +84,9 @@ template("application_snapshot") {
template("aot_assembly") {
assert(defined(invoker.main_dart), "Must specify 'main_dart'")
vm_args = []
aot_vm_args = []
if (defined(invoker.vm_args)) {
vm_args = invoker.vm_args
aot_vm_args = invoker.vm_args
}
main_dart = invoker.main_dart
name = target_name
@ -113,14 +110,11 @@ template("aot_assembly") {
if (defined(invoker.output)) {
output = invoker.output
}
compiled_action(target_name) {
tool = "$_dart_root/runtime/bin:dart_bootstrap"
gen_snapshot_action(target_name) {
deps = extra_deps
depfile = "$output.d"
main_file = rebase_path(main_dart)
inputs = extra_inputs + [ main_file ]
inputs = extra_inputs
outputs = [
output,
@ -129,12 +123,14 @@ template("aot_assembly") {
abs_depfile = rebase_path(depfile)
abs_output = rebase_path(output, root_build_dir)
args = [
vm_args = [
"--deterministic",
"--packages=$dot_packages",
"--snapshot-kind=app-aot",
"--snapshot=$abs_output",
"--snapshot-depfile=$abs_depfile",
] + vm_args + [ main_file ]
] + aot_vm_args + [ main_dart ]
args = []
}
}

View File

@ -2,8 +2,8 @@
# 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/dart_host_sdk_toolchain.gni")
import("../build/prebuilt_dart_sdk.gni")
import("../build/dart/dart_host_sdk_toolchain.gni")
import("../build/dart/prebuilt_dart_sdk.gni")
_dart_root = get_path_info("..", "abspath")

View File

@ -2,9 +2,6 @@
# 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")
import("../../build/prebuilt_dart_sdk.gni")
import("../../utils/compile_platform.gni")
import("../../utils/generate_patch_sdk.gni")
import("../create_timestamp.gni")
@ -25,21 +22,19 @@ create_timestamp_file("dartdoc_files_stamp") {
output = "$target_gen_dir/dartdoc_files.stamp"
}
compiled_action("dart2js_create_snapshot_entry") {
tool = "../../runtime/bin:dart"
dart_action("dart2js_create_snapshot_entry") {
deps = [
":dart2js_files_stamp",
":dartdoc_files_stamp",
":runtime_lib_files_stamp",
]
dot_packages = rebase_path("../../.packages")
create_snapshot_entry = rebase_path("create_snapshot_entry.dart")
output_dir = rebase_path(target_gen_dir)
script = "create_snapshot_entry.dart"
inputs = [
"../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart",
create_snapshot_entry,
"$target_gen_dir/dart2js_files.stamp",
"../../tools/VERSION",
]
@ -48,9 +43,9 @@ compiled_action("dart2js_create_snapshot_entry") {
"$target_gen_dir/dart2js.dart",
]
packages = "../../.packages"
args = [
"--packages=$dot_packages",
create_snapshot_entry,
"--output_dir=$output_dir",
"--dart2js_main=pkg/compiler/lib/src/dart2js.dart",
]

View File

@ -2,7 +2,7 @@
# 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/dart_action.gni")
import("../../build/dart/dart_action.gni")
import("../application_snapshot.gni")
group("dartanalyzer") {
@ -59,7 +59,7 @@ template("generate_summary") {
type = invoker.type
assert(type == "spec" || type == "strong")
dart_action(target_name) {
prebuilt_dart_action(target_name) {
script = "../../pkg/analyzer/tool/summary/build_sdk_summaries.dart"
packages = "../../.packages"
inputs = sdk_lib_files + analyzer_files

View File

@ -2,8 +2,7 @@
# 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/dart_action.gni")
import("../../build/prebuilt_dart_sdk.gni")
import("../../build/dart/dart_action.gni")
import("../application_snapshot.gni")
import("../create_timestamp.gni")
@ -81,8 +80,7 @@ template("dart2js_compile") {
abs_main = rebase_path(main)
abs_output = rebase_path(out)
compiled_action(target_name) {
tool = "../../runtime/bin:dart"
dart_action(target_name) {
deps = [
"../compiler:compile_dart2js_platform",
"../compiler:compile_dart2js_platform_strong",
@ -97,13 +95,11 @@ template("dart2js_compile") {
out,
]
dot_packages = rebase_path("../../.packages")
compiler = rebase_path("../../pkg/compiler/lib/src/dart2js.dart")
script = "../../pkg/compiler/lib/src/dart2js.dart"
packages = "../../.packages"
args = [
"--packages=$dot_packages",
compiler,
"--packages=$dot_packages",
"$abs_main",
"-m",
"-o$abs_output",
@ -123,7 +119,7 @@ dart2js_compile("stack_trace_mapper") {
# Apply dev_compiler's patch files to create the Dart version of the dartdevc
# SDK.
dart_action("dartdevc_patch_sdk") {
prebuilt_dart_action("dartdevc_patch_sdk") {
# TODO(rnystrom): Unfork DDC's patch_sdk.dart script with the
# tools/patch_sdk.dart and then change this to use generate_patch_sdk().
deps = [
@ -163,7 +159,7 @@ dart_action("dartdevc_patch_sdk") {
# Compiles the Dart core libraries and DDC runtime to an analyzer summary and
# JS.
dart_action("dartdevc_sdk") {
prebuilt_dart_action("dartdevc_sdk") {
deps = [
":dartdevc_files_stamp",
":dartdevc_patch_sdk",
@ -243,9 +239,7 @@ create_timestamp_file("dartdevc_files_stamp") {
# Compiles the packages used by the tests to JS with dartdevc so that they are
# available for loading by the tests.
compiled_action("dartdevc_test_pkg") {
tool = "../../runtime/bin:dart"
dart_action("dartdevc_test_pkg") {
deps = [
":dartdevc_files_stamp",
":dartdevc_sdk",
@ -293,8 +287,9 @@ compiled_action("dartdevc_test_pkg") {
"$target_gen_dir/pkg/unittest.sum",
]
script = "../../pkg/dev_compiler/tool/build_pkgs.dart"
args = [
rebase_path("../../pkg/dev_compiler/tool/build_pkgs.dart"),
"--analyzer-sdk",
rebase_path(sdk_summary),
"--kernel-sdk",
@ -305,9 +300,7 @@ compiled_action("dartdevc_test_pkg") {
}
# Compiles the DDC SDK's kernel summary and JS code.
compiled_action("dartdevc_sdk_kernel_summary") {
tool = "../../runtime/bin:dart"
dart_action("dartdevc_sdk_kernel_summary") {
deps = [
":dartdevc_files_stamp",
]
@ -328,8 +321,9 @@ compiled_action("dartdevc_sdk_kernel_summary") {
"$target_gen_dir/kernel/legacy/dart_sdk.js.map",
]
script = "../../pkg/dev_compiler/tool/kernel_sdk.dart"
args = [
rebase_path("../../pkg/dev_compiler/tool/kernel_sdk.dart"),
rebase_path(sdk_dill),
]
}

View File

@ -2,8 +2,7 @@
# 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")
import("../build/dart/dart_action.gni")
_dart_root = get_path_info("..", "abspath")
@ -22,76 +21,22 @@ template("generate_entry_points_json_with_dart_bootstrap") {
if (defined(invoker.extra_args)) {
extra_args += invoker.extra_args
}
compiled_action(target_name) {
dart_bootstrap_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
script = invoker.input
output = invoker.output
tool = "$_dart_root/runtime/bin:dart_bootstrap"
inputs = [
input,
]
outputs = [
output,
]
args = [
vm_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),
]
] + extra_args
args = []
}
}

View File

@ -2,9 +2,7 @@
# 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/dart_action.gni")
import("../build/dart_host_sdk_toolchain.gni")
import("../build/prebuilt_dart_sdk.gni")
import("../build/dart/dart_action.gni")
_dart_root = get_path_info("..", "abspath")
@ -22,7 +20,7 @@ template("generate_patched_sdk") {
"Need patched_sdk_dir in $target_name")
assert(defined(invoker.mode), "Need mode in $target_name")
dart_action(target_name) {
prebuilt_dart_action(target_name) {
forward_variables_from(invoker, [
"deps",
])

View File

@ -2,8 +2,8 @@
# 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/dart_action.gni")
import("../../build/dart_host_sdk_toolchain.gni")
import("../../build/dart/dart_action.gni")
import("../../build/dart/dart_host_sdk_toolchain.gni")
import("../application_snapshot.gni")
# TODO: Switch this to use kernel based app-jit snapshot
@ -45,7 +45,7 @@ application_snapshot("frontend_server") {
output = "$root_out_dir/frontend_server.dart.snapshot"
}
dart_action("kernel_service_dill") {
prebuilt_dart_action("kernel_service_dill") {
deps = [
"../../runtime/vm:vm_legacy_platform",
]