blob: 14d39c6ddfd2d60043a8c7eda9052982f00140c2 [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("//src/developer/ffx/build/ffx_action.gni")
# Check the route sources specified in a config file.
#
# The target that generates 'zbi' needs to be added to deps.
#
# Parameters
#
# update_package_target (required)
# [string] The target that builds the update package, including the update
# package blobfs archive file.
#
# image_assembler_target (required)
# [string] The target that assembles system images, including the system
# blobfs archive file.
#
# assembly_image_name (required)
# [string] The image_name designated in the system assembly associated with
# image_assembler_target.
#
# config_path (required)
# [string] Path to a configuration file that specifies the full set of
# routes of zero or more component instances to verify.
#
# deps, public_deps, data_deps (optional)
# Usual GN meaning.
template("verify_route_sources") {
assert(defined(invoker.update_package_target),
"verify_route_sources() must specify update_package_target")
assert(defined(invoker.image_assembler_target),
"verify_route_sources() must specify image_assembler_target")
assert(defined(invoker.assembly_image_name),
"verify_route_sources() must specify assembly_image_name")
assert(defined(invoker.config_path),
"verify_route_sources() must specify config_path")
update_package_target_out_dir =
get_label_info(invoker.update_package_target, "target_out_dir")
update_package_target_name =
get_label_info(invoker.update_package_target, "name")
update_package_dir =
"$update_package_target_out_dir/$update_package_target_name"
image_assembler_target_out_dir =
get_label_info(invoker.image_assembler_target, "target_out_dir")
assembly_image_name = invoker.assembly_image_name
image_assembler_dir = "$image_assembler_target_out_dir/$assembly_image_name"
files = {
update_package = "$update_package_dir/update.far"
blobfs = [
"$image_assembler_dir/blob.blk",
"$update_package_dir/gen/update.blob.blk",
]
}
ffx_action(target_name) {
no_output_dir_leaks = false
forward_variables_from(invoker,
[
"testonly",
"deps",
"public_deps",
"data_deps",
"visibility",
])
stamp_file = "$target_gen_dir/$target_name.verified"
depfile = "$target_gen_dir/$target_name.d"
inputs = [
invoker.config_path,
files.update_package,
] + files.blobfs
outputs = [ stamp_file ]
args = [
"scrutiny",
"verify",
"--depfile",
rebase_path(depfile, root_build_dir),
"--stamp",
rebase_path(stamp_file, root_build_dir),
"route-sources",
"--build-path",
rebase_path(root_build_dir, root_build_dir),
"--update",
rebase_path(files.update_package, root_build_dir),
"--config",
rebase_path(invoker.config_path, root_build_dir),
]
foreach(blobfs, files.blobfs) {
args += [
"--blobfs",
rebase_path(blobfs, root_build_dir),
]
}
if (!defined(invoker.deps)) {
deps = []
}
deps += [
invoker.update_package_target,
invoker.image_assembler_target,
]
}
}