| # 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. | |
| # Verifies that there are no duplicate headers in an SDK library declaration. | |
| # On failure, an error message will be printed indicating which headers | |
| # are duplicated. | |
| # | |
| # Parameters | |
| # | |
| # target_label (required) | |
| # GN label of the SDK target that exposes the headers. Used in | |
| # error messages (i.e. not a dependency). | |
| # | |
| # headers (required) | |
| # A list of header paths. | |
| # Type: list of strings. | |
| # | |
| # testonly, visibility | |
| # Usual GN meaning. | |
| # | |
| template("verify_public_headers") { | |
| _stamp_file = "$target_gen_dir/$target_name.stamp" | |
| action(target_name) { | |
| forward_variables_from(invoker, | |
| [ | |
| "testonly", | |
| "visibility", | |
| ]) | |
| script = "//build/cpp/verify_public_headers.py" | |
| inputs = [] | |
| outputs = [ _stamp_file ] | |
| args = [ | |
| "--gn-label", | |
| get_label_info(invoker.target_label, "label_no_toolchain"), | |
| "--stamp-file", | |
| rebase_path(_stamp_file, root_build_dir), | |
| ] + invoker.headers | |
| } | |
| } |