blob: c7923a54e1b747ec6785840dc73898e5993ea206 [file] [log] [blame] [edit]
# Copyright 2019 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 factory store provider configuration file against a schema.
#
# Parameters
# config (required)
# This is a factory store provider config file that needs to be validated.
template("factory_store_provider_config_validate") {
validate_json(target_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"testonly",
"visibility",
])
data = invoker.config
schema = "//src/factory/factory_store_provider_config_schema.json"
}
}
# Packages a factory store provider configuration after validating it.
#
# Parameters
# config (required)
# A file containing a configuration for a factory store provider.
# It will be schema-validated.
# provider (required)
# The factory store provider protocol that the given config maps to.
# Must be one of the following:
# fuchsia.factory.AlphaFactoryStoreProvider
# fuchsia.factory.CastCredentialsFactoryStoreProvider
# fuchsia.factory.MiscFactoryStoreProvider
# fuchsia.factory.PlayReadyFactoryStoreProvider
# fuchsia.factory.WeaveFactoryStoreProvider
# fuchsia.factory.WidevineFactoryStoreProvider
template("factory_store_provider_config") {
validate_target = target_name + "_${invoker.provider}_validate"
factory_store_provider_config_validate(validate_target) {
forward_variables_from(invoker,
[
"deps",
"testonly",
"visibility",
])
config = invoker.config
}
config_data(target_name) {
for_pkg = "factory_store_providers"
sources = [ rebase_path(invoker.config) ]
outputs = [ "${invoker.provider}.config" ]
deps = [ ":${validate_target}" ]
}
}
# Validates a factory store provider factory source configuration file.
#
# Parameters
# config (required)
# This is a factory store provider config file that needs to be validated.
template("factory_store_provider_factory_config_validate") {
validate_json(target_name) {
forward_variables_from(invoker,
[
"deps",
"public_deps",
"testonly",
"visibility",
])
data = invoker.config
schema = "//src/factory/factory_store_provider_factory_config_schema.json"
}
}
# Packages a factory store provider factory source configuration.
#
# Parameters
# config (required)
# A file containing a configuration for a factory store provider.
# It will be schema-validated.
template("factory_store_provider_factory_config") {
validate_target = target_name + "_factory_validate"
factory_store_provider_factory_config_validate(validate_target) {
forward_variables_from(invoker,
[
"deps",
"testonly",
"visibility",
])
config = invoker.config
}
config_data(target_name) {
for_pkg = "factory_store_providers"
sources = [ rebase_path(invoker.config) ]
outputs = [ "factory.config" ]
deps = [ ":${validate_target}" ]
}
}