blob: 2b76515611fd75a0a9b11abb6a8fcbebb6f6235e [file] [log] [blame]
# Copyright 2020 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/compiled_action.gni")
import("//build/toolchain/breakpad.gni")
# Generate a manifest of prebuilt binaries provided in .build-id format.
#
# Parameters
#
# build_id_dir (required)
# Path to the .build-id directory to consume.
#
# debug_archive (optional)
# Path to archive containing a .build-id tarball.
# TODO(fxbug.dev/41478): Delete me.
#
# testonly (optional)
# Usual GN meanings.
#
template("prebuilt_binaries") {
assert(defined(invoker.build_id_dir) || defined(invoker.debug_archive),
"build_id_dir or debug_archive is required")
binary_manifest = "$target_gen_dir/${target_name}_binaries.json"
compiled_action(target_name) {
# TODO(fxbug.dev/41478) Make unconditionally testonly once separated from
# prebuilt_package() instances.
forward_variables_from(invoker, [ "testonly" ])
hermetic_deps = false
tool = "//tools/debug/unpack_debug_symbols"
outputs = [ binary_manifest ]
depfile = "$target_gen_dir/$target_name.d"
args = [
"-build-dir",
rebase_path(root_build_dir),
"-build-id-dir-out",
rebase_path("$root_build_dir/.build-id"),
"-cpu",
target_cpu,
"-os",
target_os,
"-output-manifest",
rebase_path(binary_manifest, root_build_dir),
"-dump-syms",
breakpad_dump_syms,
"-depfile",
rebase_path(depfile),
]
if (defined(invoker.debug_archive)) {
args += [
"-debug-archive",
rebase_path(invoker.debug_archive),
]
} else {
args += [
"-build-id-dir-in",
rebase_path(invoker.build_id_dir),
]
}
metadata = {
prebuilt_binaries = [
{
name = target_name
manifest = rebase_path(binary_manifest, root_build_dir)
if (defined(invoker.debug_archive)) {
debug_archive = rebase_path(invoker.debug_archive, root_build_dir)
}
},
]
}
}
}