blob: c7c3d3553f51977c62f21c537c42a11ab5f352ba [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/rust/rustc_library.gni")
if (is_host) {
rustc_library("lib") {
name = "symbol-index"
version = "0.1.0"
edition = "2018"
with_unit_tests = true
sources = [ "src/lib.rs" ]
deps = [
":symbol_index_json($default_toolchain)",
"//src/developer/ffx/config:lib",
"//src/developer/ffx/lib/errors:lib",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:glob",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
]
test_deps = [
":test_data($host_toolchain)",
"//third_party/rust_crates:tempfile",
]
}
group("symbol-index") {
deps = [ ":lib" ]
}
group("tests") {
testonly = true
deps = [ ":lib_test" ]
}
}
# Use $root_build_dir instead of $root_out_dir because
# 1. It eliminates multiple copies of the data for different host toolchains.
# 2. Tests are launched with $root_build_dir as cwd, test data are relatively fixed.
if (is_host) {
host_test_data("test_data") {
sources = [
"test_data/another.json",
"test_data/main.json",
]
}
}
if (current_toolchain == default_toolchain) {
# Generate .symbol-index.json in the build directory.
generated_file("symbol_index_json") {
_symbol_index_path = "$root_build_dir/.symbol-index.json"
_source_root = rebase_path("//", root_build_dir) # ends with /
outputs = [ _symbol_index_path ]
output_conversion = "json"
contents = {
includes = [ _source_root + "vendor/*/.symbol-index.json" ]
build_id_dirs = [
{
path = ".build-id"
build_dir = "."
},
{
path =
_source_root + "prebuilt/third_party/clang/*/lib/debug/.build-id"
},
{
path =
_source_root + "prebuilt/third_party/rust/*/lib/debug/.build-id"
},
]
gcs_flat = [
{
url = "gs://fuchsia-artifacts/debug"
},
]
}
}
}