| # Copyright 2021 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/python/python_action.gni") |
| import("//bundles/assembly/platform_aibs.gni") |
| |
| # Generates a list of the files included in a product that must be uploaded by |
| # infrastructure. |
| # |
| # Arguments |
| # |
| # output_path (required) |
| # [path] Where to write the output list. |
| # |
| # sources (optional) |
| # [list of str] Additional files or directories to list as inputs. |
| # |
| # aibs (optional) |
| # [list of str] Any assembly input bundles to include. |
| # |
| template("generated_assembly_inputs") { |
| assert(defined(invoker.output_path), "Need to define output_path") |
| |
| labels = { |
| aib_list = "aib_list" |
| } |
| |
| files = { |
| aib_list = "${target_out_dir}/aib_list.json" |
| } |
| |
| generated_file(labels.aib_list) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| outputs = [ files.aib_list ] |
| data_keys = [ "assembly_input_archives" ] |
| walk_keys = [ "assembly_input_archives_barrier" ] |
| output_conversion = "json" |
| |
| deps = [] |
| if (defined(invoker.aibs)) { |
| deps += invoker.aibs |
| } |
| } |
| |
| python_action(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "metadata", |
| "testonly", |
| "visibility", |
| ]) |
| binary_label = "//build/assembly/scripts:generated_assembly_inputs" |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ ":${labels.aib_list}" ] |
| |
| outputs = [ invoker.output_path ] |
| inputs = [ files.aib_list ] |
| |
| args = [ |
| "--assembly-input-bundles", |
| rebase_path(files.aib_list, root_build_dir), |
| "--output", |
| rebase_path(invoker.output_path, root_build_dir), |
| ] |
| |
| if (defined(invoker.sources)) { |
| args += [ "--sources" ] |
| foreach(source, invoker.sources) { |
| args += [ rebase_path(source, root_build_dir) ] |
| } |
| } |
| } |
| } |