blob: cb0674edf930292cfc778b5b797ac3214ddf4bff [file] [log] [blame]
# Copyright 2021 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/python/python_action.gni")
# Creates JSON with documentation from all drivers.
# Every driver can optionally provide a ${target_name}-driver-info.json in its folder.
# Documentation from this JSON file is aggregated into a global documentation file.
# If a driver does not supply this file, an entry in the global documentation file is still
# generated.
#
# Parameters
# fuchsia_driver_doc_file
# File containing a generated driver documentation entry.
#
# testonly
# visibility
template("create_all_drivers_doc") {
main_target = target_name
all_doc_target = "${target_name}_all_doc"
all_doc_output = "${target_gen_dir}/${target_name}_all_doc"
generated_file(all_doc_target) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
visibility = [ ":$main_target" ]
outputs = [ all_doc_output ]
deps = invoker.deps
rebase = root_out_dir
# File containing driver documentation.
data_keys = [ "fuchsia_driver_doc_file" ]
walk_keys = [ "driver_component_barrier" ]
}
python_action(main_target) {
forward_variables_from(invoker, [ "testonly" ])
deps = [ ":${all_doc_target}" ]
binary_label = "//build/drivers:gen_create_all_drivers_doc"
areas_file = "//build/drivers/areas.txt"
inputs = [
all_doc_output,
areas_file,
]
outputs = [ "${target_gen_dir}/_all_drivers_doc.yaml" ]
depfile = "${target_gen_dir}/${target_name}.d"
args = [
"--areas_list",
rebase_path(areas_file, root_build_dir),
"--doc_list",
rebase_path(all_doc_output, root_build_dir),
"--output",
rebase_path(outputs[0], root_build_dir),
"--dep_file",
rebase_path(depfile, root_build_dir),
]
metadata = {
# Record metadata for the //tools/docsgen build API.
generated_docset = [
{
name = "driversdoc"
origin_files = [ rebase_path(outputs[0], root_build_dir) ]
dest_folder = "sdk/drivers"
},
]
}
}
}