blob: c69052d970d13a5f06f023f69d020f37f108258c [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("//tools/cmc/build/cml.gni")
import("resource.gni")
# Prepares some component manifest files for inclusion in a ZBI.
#
# Parameters
#
# sources
# Required: List of paths to .cml meta files
#
# required_offers (optional)
# A list of protocols that must be offered to every child and collection declared
# in the CML file.
# Type: list of strings
# Default: []
#
# required_uses (optional)
# A list of protocols that must be used by every child and collection declared
# in the CML file.
# Type: list of strings
# Default: []
#
# restricted_features (optional)
# The set of restricted CML features to allow. Only applicable to v2 components.
# The set of features is allowlisted here: //tools/cmc/build/restricted_features/BUILD.gn
# where each feature name is represented by a group of the same name.
# Type: list of strings
# Default: []
#
# deps
# testonly
# visibility
template("component_manifest_resources") {
assert(defined(invoker.sources), "Must set some sources")
compile_deps = []
compile_outputs = []
foreach(source, invoker.sources) {
extension = get_path_info(source, "extension")
assert(extension == "cml", "Only .cml files are supported: $source")
name = get_path_info(source, "name")
compile_target = "${name}.cm"
cm(compile_target) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"required_offers",
"required_uses",
"restricted_features",
"data_deps",
"testonly",
])
# NOTE: must be kept in sync with path in fuchsia_structured_config.gni
config_values_package_path = "meta/${name}.cvf"
manifest = source
output_name = "$name.cm"
visibility = [ ":*" ]
}
compile_deps += [ ":$compile_target" ]
compile_outputs += get_target_outputs(":$compile_target")
}
resource(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
sources = compile_outputs
outputs = [ "meta/{{source_file_part}}" ]
deps = compile_deps
}
}