| # Copyright 2024 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/bazel/bazel_build_action.gni") |
| |
| # A GN wrapper for a Bazel board input bundle target. This template is useful |
| # for GN board target that can consume the created BIB directory. |
| # |
| # Parameters |
| # |
| # bazel_board_input_bundle_target (required) |
| # The Bazel board input bundle target to build. |
| # Type: label (from BUILD.bazel) |
| # |
| # deps |
| # metadata |
| # testonly |
| # visibility |
| # |
| template("bazel_board_input_bundle") { |
| assert(defined(invoker.bazel_board_input_bundle_target), |
| "bazel_board_input_bundle_target is required") |
| |
| board_input_bundle_target = target_name |
| bazel_target = invoker.bazel_board_input_bundle_target |
| |
| bazel_build_action(board_input_bundle_target) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "metadata", |
| "testonly", |
| "visibility", |
| "inputs", |
| "remote_build", |
| ]) |
| |
| bazel_target = bazel_target |
| |
| # Directory outputs are OK because `board_input_bundle.json` correctly |
| # represents the freshness of all outputs. |
| directory_outputs = [ |
| { |
| bazel_dir = "{{BAZEL_TARGET_OUT_DIR}}/{{BAZEL_TARGET_NAME}}" |
| ninja_dir = board_input_bundle_target |
| tracked_files = [ "board_input_bundle.json" ] |
| }, |
| ] |
| } |
| } |