blob: 37726ad3adfb262baab6be3c8a77753ec1180a38 [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/config.gni")
import("//build/json/validate_json.gni")
# Validates a tee manager configuration file against a schema.
#
# Parameters
# config (required)
# This is the tee manager config file that needs to be validated.
template("tee_manager_config_validate") {
validate_json(target_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"testonly",
"visibility",
])
data = invoker.config
schema = "//src/security/tee_manager/tee_manager_config_schema.json"
}
}
# Generates a tee manager component, package, config after validating it.
#
# Parameters
# config (required)
# A file containing a configuration for the tee manager.
template("tee_manager_pkg_with_config") {
validate_target = "${target_name}_validate"
fuchsia_component("tee_manager_cmp") {
manifest = "meta/tee_manager.cml"
component_name = "tee_manager"
deps = [ "//src/security/tee_manager:bin" ]
}
fuchsia_package("tee_manager") {
deps = [ ":tee_manager_cmp" ]
}
tee_manager_config_validate(validate_target) {
forward_variables_from(invoker,
[
"deps",
"testonly",
"visibility",
])
config = invoker.config
}
config_data("tee_manager_config_data") {
for_pkg = "tee_manager"
sources = [ invoker.config ]
outputs = [ "tee_manager.config" ]
deps = [ ":${validate_target}" ]
}
group(target_name) {
deps = [
":tee_manager",
":tee_manager_config_data",
]
}
}
# Packages a tee manager configuration after validating it.
#
# Parameters
# config (required)
# A file containing a configuration for the tee manager.
template("tee_manager_config") {
validate_target = target_name + "_validate"
tee_manager_config_validate(validate_target) {
forward_variables_from(invoker,
[
"deps",
"testonly",
"visibility",
])
config = invoker.config
}
config_data(target_name) {
for_pkg = "tee_manager"
sources = [ invoker.config ]
outputs = [ "tee_manager.config" ]
deps = [ ":${validate_target}" ]
}
}