| # 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("//build/components.gni") |
| import("//sdk/cts/build/cts_element.gni") |
| import("//sdk/cts/build/cts_version.gni") |
| import("//sdk/cts/build/write_cts_file.gni") |
| |
| # A Fuchsia package that can be used in CTS. |
| # |
| # An equivalent to fuchsia_package, but ensures dependencies are allowed in CTS. |
| template("cts_fuchsia_package") { |
| assert(defined(invoker.package_name), "package_name must be defined.") |
| |
| if (!defined(invoker.deps)) { |
| invoker.deps = [] |
| } |
| |
| if (invoker.deps != [] && cts_version == "") { |
| verify_target = target_name + "_verify_deps" |
| } |
| write_file_target = target_name + "_cts_file" |
| |
| if (defined(verify_target)) { |
| cts_element(verify_target) { |
| deps = invoker.deps |
| invoker_label = get_label_info(invoker.target_name, "label_no_toolchain") |
| } |
| } |
| |
| write_cts_file(write_file_target) { |
| } |
| |
| fuchsia_package(target_name) { |
| forward_variables_from(invoker, "*") |
| |
| if (defined(verify_target)) { |
| deps += [ ":$verify_target" ] |
| } |
| deps += [ ":$write_file_target" ] |
| } |
| } |