blob: bc15a582e2f686b9da1d677b01270098e8ebe9da [file]
# Copyright 2025 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/compiled_action.gni")
# Generates a single file containing all possible sampler configurations for usage in assembly.
# This command doesn't validate or perform any logic beyond ensuring that the schemas are as
# expected. It'll generate a JSON file containing the contents of the input files as:
#
# {
# project_configs: [ project configs objects ],
# fire: {
# project_templates: [ project template objects ],
# component_configs: [ component config objects ],
# }
# }
#
# Parameters
#
# output:
# Required: Path to the output file. This should usually be something like
# "$target_gen_dir/my_config.json"
# Type: file
#
# fire_project_templates:
# Optional: Paths to the project template files.
# Type: list(path)
#
# fire_component_configs:
# Optional: Paths to the FIRE component configuration files.
# Type: list(path)
#
# project_configs:
# Optional: Paths to regular sampler configuration files.
# Type: list(path)
#
template("merged_sampler_config") {
assert(defined(invoker.output), "must pass the output file path")
fire_project_templates = []
if (defined(invoker.fire_project_templates)) {
fire_project_templates += invoker.fire_project_templates
}
fire_component_configs = []
if (defined(invoker.fire_component_configs)) {
fire_component_configs += invoker.fire_component_configs
}
project_configs = []
if (defined(invoker.project_configs)) {
project_configs += invoker.project_configs
}
compiled_action(target_name) {
forward_variables_from(invoker,
"*",
[
"fire_project_templates",
"fire_component_configs",
"project_configs",
"output",
])
tool = "//src/diagnostics/tools/merge_sampler_configs"
inputs = []
args = [
"--output",
rebase_path(invoker.output, root_build_dir),
]
foreach(project_path, fire_project_templates) {
args += [
"--fire-project-template",
rebase_path(project_path, root_build_dir),
]
inputs += [ project_path ]
}
foreach(component_config_path, fire_component_configs) {
args += [
"--fire-component-config",
rebase_path(component_config_path, root_build_dir),
]
inputs += [ component_config_path ]
}
foreach(project_path, project_configs) {
args += [
"--project-config",
rebase_path(project_path, root_build_dir),
]
inputs += [ project_path ]
}
outputs = [ invoker.output ]
}
}