blob: 1e64a27da1a7a0fb69e5a7efe771e63e79528dcf [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.
template("prebuilt_binaries") {
assert(defined(invoker.build_id_dir), "build_id_dir is required")
binary_manifest = "$target_gen_dir/${target_name}_binaries.json"
rebased_binary_manifest = rebase_path(binary_manifest, root_build_dir)
# This file is updated by //build/regenerator.py each time the content
# of //prebuilt/.build-id changes. Because it is located in the source
# directory, it can appear in `inputs` below and GN will not complain
# that there is no GN target generating it. Note that //prebuilt/
# is listed in the top-level .gitignore.
# LINT.IfChange(prebuilt_build_ids_list)
build_ids_list_file = "//prebuilt/prebuilt-build-id-list.txt"
# LINT.ThenChange(//build/regenerator.py:prebuilt_build_ids_list)
compiled_action(target_name) {
testonly = true
tool = "//tools/debug/generate_breakpad"
outputs = [ binary_manifest ]
inputs = [
build_ids_list_file,
breakpad_dump_syms_prebuilt,
]
args = [
"-build-id-dir-in",
rebase_path(invoker.build_id_dir, root_build_dir),
"-build-id-dir-out",
rebase_path("$root_build_dir/.build-id", root_build_dir),
"-cpu",
target_cpu,
"-os",
target_os,
"-output-manifest",
rebase_path(binary_manifest, root_build_dir),
"-dump-syms",
rebase_path(breakpad_dump_syms_prebuilt, root_build_dir),
]
metadata = {
# Used by //:prebuilt_binaries target.
prebuilt_binaries = [
{
name = target_name
manifest = rebased_binary_manifest
},
]
# Used by //:debug_symbols taraget.
debug_symbol_manifests = [
{
label = get_label_info(":$target_name", "label_with_toolchain")
manifest = rebased_binary_manifest
},
]
}
# This action reads an arbitrary number of files from //prebuilt/.build-id/
# and writes an arbitrary number of files into $root_build_dir/.build-id.
hermetic_deps = false
}
not_needed(invoker, "*")
}