blob: 7cf55581d6600d4a2f63200dc671f9127d117b08 [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 ]
}
metadata = {
# expect_includes are not relevant for dependency verification, so disarm
# them here to avoid spurious include errors.
expect_includes_barrier = []
}
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, root_build_dir),
"--output",
rebase_path(outputs[0], root_build_dir),
"--invoker_label",
invoker_label,
"--deps",
]
args += fully_qualified_deps
args += [ "--allowed_cts_deps" ]
args += ALLOWED_CTS_DEPS
args += ALLOWED_RUST_DEPS
args += ALLOWED_EXPERIMENTAL_FIDL
args += [ "--allowed_cts_dirs" ]
args += ALLOWED_CTS_DIRS
args += [ "--sdk_manifests" ]
args += rebase_path(inputs, root_build_dir)
}
}