| # 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/dev.gni") |
| import("//src/developer/ffx/build/ffx_action.gni") |
| |
| # Validates that all use statements for protocols & directories has a valid |
| # expose-offer-use chain and in the case of directories that the correct |
| # rights are provided. |
| # |
| # Parameters |
| # |
| # allowlist (required) |
| # [list of strings] paths to allowlist files to be passed to |
| # `ffx scrutiny verify routes`. |
| # |
| # component_tree_config (optional) |
| # [string] paths to component tree configuration file to be passed to |
| # `ffx scrutiny verify routes`. |
| # |
| # testonly, deps, public_deps, data_deps, visibility (optional) |
| # Usual GN meaning. |
| # |
| template("verify_routes") { |
| ffx_action(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "deps", |
| "public_deps", |
| "data_deps", |
| "visibility", |
| ]) |
| |
| depfile = "$target_out_dir/$target_name.d" |
| stamp_file = "$target_gen_dir/$target_name.verified" |
| published_packages = "//build/images:publish" |
| |
| inputs = invoker.allowlist |
| outputs = [ stamp_file ] |
| |
| args = [ |
| "scrutiny", |
| "verify", |
| "routes", |
| "--build-path", |
| rebase_path(root_build_dir, root_build_dir), |
| "--repository-path", |
| rebase_path("$root_build_dir/amber-files/repository", root_build_dir), |
| "--stamp", |
| rebase_path(stamp_file, root_build_dir), |
| "--depfile", |
| rebase_path(depfile, root_build_dir), |
| ] |
| if (defined(invoker.component_tree_config)) { |
| inputs += [ invoker.component_tree_config ] |
| args += [ |
| "--component-tree-config", |
| rebase_path(invoker.component_tree_config, root_build_dir), |
| ] |
| } |
| foreach(allowlist, invoker.allowlist) { |
| args += [ |
| "--allowlist", |
| rebase_path(allowlist, root_build_dir), |
| ] |
| } |
| if (!defined(invoker.deps)) { |
| deps = [] |
| } |
| |
| deps += [ published_packages ] |
| } |
| } |