blob: cf293976d5ff7c6121fad931abecd9e756cbe8e0 [file] [log] [blame]
# 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 (optional)
# [list] List of paths to the product configs.
#
# 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.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" ]
walk_keys = [ "assembly_input_archives_barrier" ]
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 ]
args = [
"--assembly-input-bundles",
rebase_path(files.platform_aibs, root_build_dir),
"--output",
rebase_path(invoker.output_path, root_build_dir),
"--depfile",
rebase_path(depfile_path, root_build_dir),
]
if (defined(invoker.product_configs)) {
inputs += invoker.product_configs
args += [ "--product-config" ]
foreach(product_config, invoker.product_configs) {
args += [ rebase_path(product_config, root_build_dir) ]
}
}
if (defined(invoker.sources)) {
args += [ "--sources" ]
foreach(source, invoker.sources) {
args += [ rebase_path(source, root_build_dir) ]
}
}
}
}