2017-10-17 11:29:50 +00:00
|
|
|
# Copyright (c) 2017, 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.
|
|
|
|
|
2018-06-19 17:57:28 +00:00
|
|
|
import("../build/dart/dart_action.gni")
|
2020-07-07 06:08:20 +00:00
|
|
|
import("../sdk_args.gni")
|
2018-05-17 20:54:06 +00:00
|
|
|
|
2017-10-17 11:29:50 +00:00
|
|
|
_dart_root = get_path_info("..", "abspath")
|
|
|
|
|
|
|
|
template("compile_platform") {
|
2018-06-13 23:50:54 +00:00
|
|
|
assert(defined(invoker.libraries_specification_uri),
|
2018-06-15 20:19:21 +00:00
|
|
|
"Need 'libraries_specification_uri' in $target_name")
|
2017-10-17 11:29:50 +00:00
|
|
|
assert(defined(invoker.outputs), "Need 'outputs' in $target_name")
|
|
|
|
assert(defined(invoker.args), "Need 'args' in $target_name")
|
2018-06-13 22:14:14 +00:00
|
|
|
if (defined(invoker.single_root_scheme)) {
|
|
|
|
assert(defined(invoker.single_root_base),
|
2018-06-15 20:19:21 +00:00
|
|
|
"Need 'single_root_base' in $target_name")
|
2018-06-13 22:14:14 +00:00
|
|
|
}
|
|
|
|
if (defined(invoker.single_root_base)) {
|
|
|
|
assert(defined(invoker.single_root_scheme),
|
2018-06-15 20:19:21 +00:00
|
|
|
"Need 'single_root_scheme' in $target_name")
|
2018-06-13 22:14:14 +00:00
|
|
|
}
|
2017-10-17 11:29:50 +00:00
|
|
|
assert(!defined(invoker.script), "Remove 'script' from $target_name")
|
|
|
|
assert(!defined(invoker.depfile), "Remove 'depfile' from $target_name")
|
|
|
|
|
2018-06-13 20:49:54 +00:00
|
|
|
# In order to automatically compute dependencies, we need to add a dependency
|
|
|
|
# on vm_outline.dill. This is used to include the source code of Fasta itself
|
|
|
|
# in the dependency file. Without this, a change to Fasta wouldn't cause the
|
|
|
|
# platform dill files to be rebuilt. However, when building
|
|
|
|
# vm_outline_strong.dill, we shouldn't list it as a dependency as this would
|
|
|
|
# lead to cyclic dependencies.
|
|
|
|
add_implicit_vm_platform_dependency = true
|
|
|
|
if (defined(invoker.add_implicit_vm_platform_dependency)) {
|
|
|
|
add_implicit_vm_platform_dependency =
|
|
|
|
invoker.add_implicit_vm_platform_dependency
|
|
|
|
}
|
|
|
|
|
2019-02-21 18:22:39 +00:00
|
|
|
outline = "vm_outline_strong.dill"
|
|
|
|
if (defined(invoker.outline)) {
|
|
|
|
outline = invoker.outline
|
|
|
|
}
|
|
|
|
|
2018-06-19 17:57:28 +00:00
|
|
|
prebuilt_dart_action(target_name) {
|
2021-07-26 15:20:46 +00:00
|
|
|
if (defined(invoker.pool)) {
|
|
|
|
pool = invoker.pool
|
|
|
|
}
|
2018-06-19 17:57:28 +00:00
|
|
|
script = "$_dart_root/pkg/front_end/tool/_fasta/compile_platform.dart"
|
|
|
|
|
2021-10-12 20:16:15 +00:00
|
|
|
packages = "$_dart_root/.dart_tool/package_config.json"
|
2017-10-17 11:29:50 +00:00
|
|
|
|
|
|
|
outputs = invoker.outputs
|
|
|
|
|
2020-07-07 06:08:20 +00:00
|
|
|
vm_args = [ "-Dsdk_hash=$sdk_hash" ]
|
|
|
|
|
2017-10-17 11:29:50 +00:00
|
|
|
inputs = []
|
|
|
|
deps = []
|
|
|
|
args = []
|
|
|
|
if (defined(invoker.deps)) {
|
|
|
|
deps += invoker.deps
|
|
|
|
}
|
|
|
|
|
|
|
|
if (defined(invoker.inputs)) {
|
|
|
|
inputs += invoker.inputs
|
|
|
|
}
|
|
|
|
|
2018-06-13 20:49:54 +00:00
|
|
|
if (add_implicit_vm_platform_dependency) {
|
2019-02-21 18:22:39 +00:00
|
|
|
inputs += [ "$root_out_dir/$outline" ]
|
2018-06-13 20:49:54 +00:00
|
|
|
deps += [ "$_dart_root/runtime/vm:vm_platform" ]
|
|
|
|
}
|
2017-10-17 11:29:50 +00:00
|
|
|
depfile = outputs[0] + ".d"
|
|
|
|
|
|
|
|
args += invoker.args
|
2018-06-13 22:14:14 +00:00
|
|
|
if (defined(invoker.single_root_scheme)) {
|
2018-06-15 20:19:21 +00:00
|
|
|
args += [ "--single-root-scheme=" + invoker.single_root_scheme ]
|
2018-06-13 22:14:14 +00:00
|
|
|
}
|
|
|
|
if (defined(invoker.single_root_base)) {
|
2018-06-15 20:19:21 +00:00
|
|
|
args += [ "--single-root-base=" + invoker.single_root_base ]
|
2018-06-13 22:14:14 +00:00
|
|
|
}
|
|
|
|
if (defined(invoker.single_root_scheme)) {
|
2018-06-15 20:19:21 +00:00
|
|
|
args += [ invoker.libraries_specification_uri ]
|
2018-06-13 22:14:14 +00:00
|
|
|
} else {
|
2018-06-15 20:19:21 +00:00
|
|
|
args +=
|
|
|
|
[ rebase_path(invoker.libraries_specification_uri, root_build_dir) ]
|
2018-06-13 22:14:14 +00:00
|
|
|
}
|
2020-03-10 21:56:11 +00:00
|
|
|
args += [ rebase_path("$root_out_dir/$outline", root_build_dir) ]
|
2017-10-17 11:29:50 +00:00
|
|
|
args += rebase_path(outputs, root_build_dir)
|
|
|
|
}
|
|
|
|
}
|