blob: 5dbacb8864eeb1cd1cf826657455dafcb64a78f7 [file] [log] [blame]
# Copyright 2019 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/config/fuchsia/zircon.gni")
# The `gn gen` stage of the Zircon GN build writes this file.
# It's a list of {name=... path=... type=...} scopes.
zircon_images = read_file("$zircon_root_build_dir/legacy_images.json", "json")
foreach(image, zircon_images) {
if (image.name == "kernel" && image.type == "zbi" &&
image.cpu == target_cpu) {
zircon_kernel_zbi = "$zircon_root_build_dir/${image.path}"
}
}
# Produce a manifest of binaries from the Zircon build.
#
# This is meant to be used with a package() target that does:
# deps = [ this_target ]
# extras = get_target_outputs(this_target)
#
# Parameters
#
# manifest
# - Required: Which Zircon manifest to draw from.
# - Type: "image" or "tests"
#
# patterns
# - Required: List of filename patterns to match in the manifest.
# These are shell filename patterns that match the whole target path
# with no leading slash: "bin/foo" or "bin/*" or "*" all match "bin/foo".
# - Type: list(string)
#
template("zircon_extras_manifest") {
assert(defined(invoker.manifest), "Parameter 'manifest' is required")
assert(invoker.manifest == "image" || invoker.manifest == "tests",
"Parameter 'manifest' can only be 'image' or 'tests'")
manifest_deps = [ "//build/unification/images:migrated-${invoker.manifest}" ]
if (invoker.manifest == "tests") {
manifest_deps += [
"//build/unification/images:legacy-${invoker.manifest}",
]
}
manifest_sources = []
foreach(dep, manifest_deps) {
out_dir = get_label_info(dep, "target_out_dir")
name = get_label_info(dep, "name")
manifest_sources += [ "$out_dir/$name.unification.manifest" ]
}
action(target_name) {
forward_variables_from(invoker,
[
"visibility",
"testonly",
])
sources = manifest_sources
deps = manifest_deps
outputs = [
"$target_gen_dir/$target_name.manifest",
]
script = "//build/images/manifest.py"
args = [ "--output=" + rebase_path(outputs[0], root_build_dir) ]
foreach(pattern, invoker.patterns) {
args += [ "--include=$pattern" ]
}
foreach(manifest, sources) {
args += [
"--cwd=.",
"--manifest=" + rebase_path(manifest, root_build_dir),
]
}
}
}