blob: 8ac3df6f8fd404764ac62af9f98370986f090f7e [file] [log] [blame]
# Copyright 2020 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/dist/fini_manifest.gni")
# Validates a component manifest against a package manifest.
# Checks that the component manifest doesn't reference files that are not
# present in the package.
#
# Parameters
#
# component_manifest (required)
# A component manifest to validate.
# Type: path
#
# package_manifest (optional)
# A package manifest to validate against.
# If not provided, a package manifest will be generated out of deps.
# Type: path
#
# label (required)
# A GN label to use in error messages, to make troubleshooting easier.
# Type: label
#
# data_deps
# deps
# public_deps
# testonly
# visibility
template("validate_component_manifest_references") {
assert(
defined(invoker.component_manifest),
"Must specify exactly one of component_manifest, component_manifests_rspfile")
if (defined(invoker.package_manifest)) {
package_manifest = invoker.package_manifest
} else {
fini_target = "${target_name}_fini"
package_manifest = "$target_gen_dir/${fini_target}_file"
fini_manifest(fini_target) {
forward_variables_from(invoker,
[
"data_deps",
"deps",
"public_deps",
"testonly",
])
visibility = [ ":*" ]
outputs = [ package_manifest ]
}
}
stamp_file = "$target_gen_dir/$target_name.action.stamp"
action(target_name) {
forward_variables_from(invoker,
[
"data_deps",
"deps",
"public_deps",
"testonly",
"visibility",
])
script = "//tools/cmc/build/validate_component_manifest_references.py"
inputs = [
package_manifest,
invoker.component_manifest,
]
outputs = [ stamp_file ]
args = [
"--component_manifest",
rebase_path(invoker.component_manifest, root_build_dir),
"--package_manifest",
rebase_path(package_manifest, root_build_dir),
"--gn-label",
invoker.label,
"--stamp",
rebase_path(stamp_file, root_build_dir),
]
if (!defined(deps)) {
deps = []
}
if (defined(fini_target)) {
deps += [ ":$fini_target" ]
}
}
}