| # 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 modular framework configuration file against a schema |
| # |
| # Parameters |
| # config (required) |
| # This is a modular framework configuration file that needs to be validated. |
| template("modular_config_validate") { |
| validate_json(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "public_deps", |
| "testonly", |
| "visibility", |
| ]) |
| |
| data = invoker.config |
| schema = "//peridot/build/modular_config/modular_config_schema.json" |
| } |
| } |
| |
| # Packages a modular framework configuration after validating the configuration. |
| # Configuration will be found in basemgr's /config/data/startup.config. |
| # |
| # Parameters |
| # config (required) |
| # This is a file containing configuration for the modular framework. |
| # It will be schema-validated. |
| template("modular_config") { |
| modular_config_validate(target_name + "_validate") { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "testonly", |
| "visibility", |
| ]) |
| |
| config = invoker.config |
| } |
| |
| config_data("basemgr.config") { |
| for_pkg = "sysmgr" |
| sources = [ |
| "//peridot/build/modular_config/basemgr.config", |
| ] |
| outputs = [ |
| "basemgr.config", |
| ] |
| } |
| |
| config_data(invoker.target_name) { |
| for_pkg = "basemgr" |
| sources = [ |
| rebase_path(invoker.config), |
| ] |
| outputs = [ |
| "startup.config", |
| ] |
| |
| deps = [ |
| ":${invoker.target_name}_validate", |
| ":basemgr.config", |
| ] |
| } |
| } |