| # 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 |
| # |
| # product_configs (required) |
| # [list] List of paths to the product configs. |
| # |
| # images_configs (required) |
| # [list] List of paths to the images configs. |
| # |
| # partitions_config (required) |
| # [path] The path to the partitions config. |
| # |
| # output_path (required) |
| # [path] Where to write the output list. |
| # |
| # sources (optional) |
| # [list of str] Additional files or directories to list as inputs. |
| # |
| template("generated_assembly_inputs") { |
| assert(defined(invoker.product_configs), "Need to define product_configs") |
| assert(defined(invoker.images_configs), "Need to define images_configs") |
| assert(defined(invoker.partitions_config), "Need to define partitions_config") |
| assert(defined(invoker.output_path), "Need to define output_path") |
| |
| labels = { |
| platform_aibs = "platform_assembly_input_bundles" |
| } |
| |
| files = { |
| platform_aibs = "${target_out_dir}/platform_assembly_input_bundles.json" |
| } |
| |
| generated_file(labels.platform_aibs) { |
| forward_variables_from(invoker, |
| [ |
| "testonly", |
| "visibility", |
| ]) |
| outputs = [ files.platform_aibs ] |
| data_keys = [ "assembly_input_archives" ] |
| output_conversion = "json" |
| |
| deps = [] |
| |
| # The platform bundles |
| if (testonly) { |
| deps += eng_platform_aib_labels |
| } else { |
| deps += user_platform_aib_labels |
| } |
| |
| # The legacy bundle from the assembly. |
| if (defined(invoker.deps)) { |
| deps += invoker.deps |
| } |
| } |
| |
| python_action(target_name) { |
| forward_variables_from(invoker, |
| [ |
| "deps", |
| "testonly", |
| "visibility", |
| ]) |
| binary_label = "//build/assembly/scripts:generated_assembly_inputs" |
| |
| if (!defined(deps)) { |
| deps = [] |
| } |
| deps += [ ":${labels.platform_aibs}" ] |
| |
| depfile_path = "$target_out_dir/$target_name.depfile" |
| depfile = depfile_path |
| |
| outputs = [ invoker.output_path ] |
| inputs = [ |
| files.platform_aibs, |
| invoker.partitions_config, |
| ] + invoker.images_configs + invoker.product_configs |
| |
| args = [ |
| "--assembly-input-bundles", |
| rebase_path(files.platform_aibs, root_build_dir), |
| "--partitions-config", |
| rebase_path(invoker.partitions_config, root_build_dir), |
| "--output", |
| rebase_path(invoker.output_path, root_build_dir), |
| "--depfile", |
| rebase_path(depfile_path, root_build_dir), |
| ] |
| |
| args += [ "--product-config" ] |
| foreach(product_config, invoker.product_configs) { |
| args += [ rebase_path(product_config, root_build_dir) ] |
| } |
| |
| args += [ "--images-config" ] |
| foreach(images_config, invoker.images_configs) { |
| args += [ rebase_path(images_config, root_build_dir) ] |
| } |
| |
| if (defined(invoker.sources)) { |
| args += [ "--sources" ] |
| foreach(source, invoker.sources) { |
| args += [ rebase_path(source, root_build_dir) ] |
| } |
| } |
| } |
| } |