| # Copyright 2019 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/banjo/banjo.gni") |
| |
| # This template simply defers to the `banjo` template used in the Fuchsia |
| # GN build. |
| template("banjo_library") { |
| main_target_name = target_name |
| |
| # List a set of prefixes that do not need the banjo_dummy() target. |
| # These are (for now): |
| # * "ddk.protocol.*" |
| # * "ddk.hw.*" |
| target_type = "banjo" |
| if (string_replace("//$target_name", "//ddk.protocol.", "") == |
| "//$target_name" && |
| string_replace("//$target_name", "//ddk.hw.", "") == "//$target_name") { |
| target_type = "banjo_dummy" |
| } |
| |
| target(target_type, main_target_name) { |
| forward_variables_from(invoker, |
| "*", |
| [ |
| "deps", |
| "public_deps", |
| "sdk", |
| ]) |
| |
| name = main_target_name |
| |
| # Tests migrated from the Zircon build depend on Banjo libraries. |
| # However, these tests cannot be marked as "testonly" |
| # for legacy reasons (in short: the -many- targets that transitively depend |
| # on them via manifests are not testonly). Rather than introduce a huge |
| # number of testonly markers everywhere, we disable it here, knowing that |
| # we can and should reintroduce it when these libraries are migrated away |
| # from the Zircon build. This seems like an acceptable compromise given that |
| # the vast majority of these libraries do not have the marker anyways. |
| testonly = false |
| |
| deps = [] |
| if (defined(invoker.public_deps)) { |
| deps += invoker.public_deps |
| } |
| } |
| } |