| # 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. |
| |
| # Defines an alias for an SDK atom or molecule. |
| # |
| # Parameters |
| # |
| # target |
| # The label of the aliased element. |
| # |
| # type |
| # The type of the target. Must be "atom". |
| # |
| # non_sdk_deps (optional) |
| # List of GN labels which this target needs built. |
| |
| template("sdk_alias") { |
| assert(defined(invoker.target), "Must define a target to alias") |
| assert(defined(invoker.type), "Must define a target type") |
| assert(invoker.type == "atom", "Unexpected type") |
| |
| group(target_name) { |
| forward_variables_from(invoker, [ "testonly" ]) |
| |
| public_deps = [ invoker.target ] |
| |
| if (defined(invoker.non_sdk_deps)) { |
| public_deps += invoker.non_sdk_deps |
| } |
| |
| metadata = { |
| # Used by idk_prebuild_manifest() template. |
| idk_atom_prebuild_info = [ |
| { |
| atom_type = "alias" |
| atom_label = get_label_info(":${target_name}", "label_no_toolchain") |
| atom_actual = get_label_info(invoker.target, "label_no_toolchain") |
| }, |
| ] |
| } |
| } |
| } |