blob: aa1f9eaf6644d30cea916e339d007f6ce4521e5b [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")
# Creates an archive for the Fuchsia Package for an Assembly Input Bundle.
#
# This is a tgz that contains the entire contents of the AIB, including the
# meta.far file as well. See the AssemblyInputBundle documentation at:
# //build/python/modules/assembly/assembly_input_bundle.py
#
# Parameters
#
# archive_name (optional; default: target_name)
# [string] A different name for the archive, if not the name of the target.
#
# archive_outdir (optional; default: target_out_dir)
# [path] A different directory to write the archive into.
#
# manifest
# [path] The path to the FINI manifest created for the
# assembly input bundle
#
# meta_far
# [path] The path to the meta far created for the assembly input bundle's package
#
template("assembly_input_bundle_archive") {
assert(defined(invoker.manifest),
"A manifest path must be specified: " +
get_label_info(target_name, "label_with_toolchain"))
archive_outdir = target_out_dir
if (defined(invoker.archive_outdir)) {
archive_outdir = invoker.archive_outdir
}
archive_name = target_name
if (defined(invoker.archive_name)) {
archive_name = invoker.archive_name
}
labels = {
tarmaker = "//build/tools/tarmaker($host_toolchain)"
}
files = {
tarmaker = host_out_dir + "/tarmaker"
archive = "${archive_outdir}/${archive_name}.tgz"
archive_creation_manifest = "${archive}.creation_manifest.fini"
depfile = "${archive}.d"
}
python_action(target_name) {
forward_variables_from(invoker,
[
"testonly",
"visibility",
])
binary_label = "//build/assembly/scripts:assembly_input_bundle_tool"
inputs = [
invoker.manifest,
files.tarmaker,
]
outputs = [
files.archive,
files.archive_creation_manifest,
]
depfile = files.depfile
args = [
"generate-archive",
"--tarmaker",
rebase_path(files.tarmaker, root_build_dir),
"--contents-manifest",
rebase_path(invoker.manifest, root_build_dir),
"--creation-manifest",
rebase_path(files.archive_creation_manifest, root_build_dir),
"--output",
rebase_path(files.archive, root_build_dir),
"--depfile",
rebase_path(files.depfile, root_build_dir),
]
deps = [ labels.tarmaker ]
if (defined(invoker.deps)) {
deps += invoker.deps
}
if (defined(invoker.meta_far)) {
args += [
"--meta-far",
rebase_path(invoker.meta_far, root_build_dir),
]
}
metadata = {
assembly_input_archives = [
{
path = rebase_path(files.archive, root_build_dir)
label = get_label_info(":$target_name", "label_with_toolchain")
},
]
}
}
}