blob: aa22ce420ed3a30ba083c8400c66a76c9e84632b [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/cts_element.gni")
import("//sdk/cts/build/cts_vars.gni")
import("//src/sys/build/components.gni")
# A Fuchsia component that can be used in CTS.
#
# An equivalent to fuchsia_component, but ensures dependencies are allowed in CTS.
#
# Example:
# ```
# cts_fuchsia_component("my-test-component") {
# deps = [ ":my-test" ]
# manifest = "meta/my-test.cmx"
# testonly = true
# }
# ```
template("cts_fuchsia_component") {
if (defined(invoker.deps) && invoker.deps != []) {
cts_element("${target_name}_verify_deps") {
deps = invoker.deps
invoker_label = get_label_info(invoker.target_name, "label_no_toolchain")
}
}
fuchsia_component(target_name) {
forward_variables_from(invoker, "*")
if (defined(deps) && deps != []) {
deps += [ ":${target_name}_verify_deps" ]
}
}
# Creates a file to enable other CTS targets to depend on this test package.
target_build_dir = get_label_info(":$target_name", "dir")
target_build_dir = string_replace(target_build_dir, "//", "/")
write_file(
"${root_build_dir}/cts/${target_build_dir}/${target_name}.${cts_extension}",
true)
}