| # 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") |
| |
| template("hybrid_board_configuration") { |
| assert(defined(invoker.board_config), "board_config must be defined") |
| assert(defined(invoker.replace_partitions_config), |
| "replace_partitions_config must be defined") |
| |
| board_config = invoker.board_config |
| partitions = invoker.replace_partitions_config |
| |
| files = { |
| board_config = get_label_info(board_config, "target_out_dir") + "/" + |
| get_label_info(board_config, "name") |
| partitions = get_label_info(partitions, "target_out_dir") + "/" + |
| get_label_info(partitions, "name") |
| output = "$target_out_dir/$target_name" |
| } |
| |
| compiled_action(target_name) { |
| testonly = true |
| |
| # The contents of these folders are dynamic, and managed entirely by this |
| # action. Further, this action will need to delete items from these |
| # directories that are not added back (on an incremental build, if an item |
| # is removed from one of these sets) |
| hermetic_action_ignored_prefixes = [ |
| files.board_config, |
| files.partitions, |
| files.output, |
| ] |
| |
| tool = "//build/assembly/tools/assembly_config" |
| tool_output_name = "assembly_config" |
| |
| depfile_path = "$target_out_dir/$target_name.depfile" |
| depfile = depfile_path |
| |
| outputs = [ "${files.output}/board_configuration.json" ] |
| |
| args = [ |
| "generate", |
| "hybrid-board", |
| "--config", |
| rebase_path(files.board_config, root_build_dir), |
| "--replace-partitions-config", |
| rebase_path(files.partitions, root_build_dir), |
| "--output", |
| rebase_path(files.output, root_build_dir), |
| "--depfile", |
| rebase_path(depfile_path, root_build_dir), |
| ] |
| |
| deps = [ |
| board_config, |
| partitions, |
| ] |
| } |
| } |