blob: 6504c58f110e6f754237592aee29bb2e7f82a76d [file] [log] [blame]
# Copyright 2020 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("//sdk/cts/build/allowed_cts_deps.gni")
# Defines a CTS element.
#
# Ensures that dependencies are allowed in CTS. This template should not be used
# directly, but through the other CTS templates.
template("cts_element") {
assert(defined(invoker.deps))
assert(defined(invoker.invoker_label))
fully_qualified_deps = []
foreach(dep, invoker.deps) {
fully_qualified_deps += [ get_label_info(dep, "label_no_toolchain") ]
}
action(target_name) {
forward_variables_from(invoker, "*")
inputs = []
foreach(sdk, ALLOWED_CTS_SDKS) {
sdk_manifest_copy = sdk + "_copy($target_toolchain)"
sdk_manifest = get_label_info(sdk_manifest_copy, "root_out_dir") +
"/sdk/manifest/" + get_label_info(sdk, "name")
deps += [ sdk_manifest_copy ]
inputs += [ sdk_manifest ]
}
testonly = true
script = "//sdk/cts/build/scripts/verify_cts_deps.py"
# GN requires an action to output a file. This file is written, but not used.
outputs = [ "${target_gen_dir}/${target_name}_DEPFILE" ]
args = [
"--root_build_dir",
rebase_path(root_build_dir),
"--output",
rebase_path(outputs[0]),
"--invoker_label",
invoker_label,
"--deps",
] + fully_qualified_deps + [ "--allowed_cts_deps" ] +
ALLOWED_CTS_DEPS + [ "--allowed_cts_dirs" ] + ALLOWED_CTS_DIRS +
[ "--sdk_manifests" ] + rebase_path(inputs)
}
}