Files
sdk/utils/generate_patch_sdk.gni
T
Zachary Anderson e842c9b0b5 [infra] Use dart_action() instead of python scripts
This change shifts logic for invoking Dart scripts during the build
from a couple of python scripts to a new template called dart_action().

Change-Id: Ic0818122cd7317cbd22a7255d880fe8f87271b7e
Reviewed-on: https://dart-review.googlesource.com/39260
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-02-06 21:51:13 +00:00

54 lines
1.8 KiB
Plaintext

# 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.
import("../build/dart_action.gni")
import("../build/dart_host_sdk_toolchain.gni")
import("../build/prebuilt_dart_sdk.gni")
_dart_root = get_path_info("..", "abspath")
# Template to generate a patched_sdk folder.
#
# This template expects four arguments:
# - mode: vm or dart2js (whether to build an sdk for the vm or for dart2js)
# - input_patches_dir: directory containing the input library files.
# - patched_sdk_dir: the output location
# - deps: extra dependencies that must be built ahead of time.
template("generate_patched_sdk") {
assert(defined(invoker.input_patches_dir),
"Need input_patches_dir in $target_name")
assert(defined(invoker.patched_sdk_dir),
"Need patched_sdk_dir in $target_name")
assert(defined(invoker.mode), "Need mode in $target_name")
dart_action(target_name) {
forward_variables_from(invoker, [
"deps",
])
depfile = "$root_out_dir/${target_name}_patched_sdk.d"
script = "$_dart_root/tools/patch_sdk.dart"
if (defined(invoker.outputs)) {
outputs = invoker.outputs
} else {
outputs = [
# Instead of listing all outputs we list those consumed by
# other BUILD rules.
"$root_out_dir/${invoker.patched_sdk_dir}/platform.dill",
"$root_out_dir/${invoker.patched_sdk_dir}/outline.dill",
]
}
args = [
invoker.mode,
rebase_path("$_dart_root/sdk"),
rebase_path(invoker.input_patches_dir),
rebase_path("$root_out_dir/${invoker.patched_sdk_dir}", root_build_dir),
rebase_path("$_dart_root/.packages"),
]
}
}