blob: 3c26dc21b0f0e7f7f36be3baa5f1224f26bc0962 [file] [log] [blame]
# Copyright 2022 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/compiled_action.gni")
# Generates a machine-readable, JSON-formatted, FIDL API summary.
#
# For details on the FIDL API summary format, see RFC-0076 at:
# https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs/0076_fidl_api_summaries
#
# Args:
#
# inputs: list(label)
# A singleton list naming the FIDL IR file to read.
#
# outputs: list(label)
# A singleton naming the output API summary file to generate.
#
# applicable_licenses: list(label)
# testonly: bool(optional)
# deps: list(label)
# visiblility: list(label)
template("fidl_summary_json") {
compiled_action("${target_name}") {
forward_variables_from(invoker,
[
"applicable_licenses",
"appl",
"testonly",
"deps",
"metadata",
"inputs",
"outputs",
"visibility",
])
assert(defined(inputs), "inputs is required")
assert(inputs != [] && inputs == [ inputs[0] ],
"inputs must have exactly one element")
_json_representation = inputs[0]
assert(defined(outputs), "outputs is required")
assert(defined(outputs) && outputs != [] && outputs == [ outputs[0] ],
"outputs must have exactly one element")
_summary_file_json = outputs[0]
tool = "//tools/fidl/fidl_api_summarize"
args = [
"--fidl-ir-file",
rebase_path(_json_representation, root_build_dir),
"--output-file",
rebase_path(_summary_file_json, root_build_dir),
"--suppress-empty-library",
]
}
}