| # 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") |
| import("//build/sdk/sdk_data.gni") |
| |
| # "symbol-index is used cross toolchain with |
| # //sdk. |
| |
| rustc_library("lib") { |
| name = "symbol-index" |
| version = "0.1.0" |
| edition = "2021" |
| 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:home", |
| "//third_party/rust_crates:schemars", |
| "//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") { |
| public_deps = [ ":lib" ] |
| } |
| group("tests") { |
| testonly = true |
| |
| deps = [ ":lib_test" ] |
| } |
| |
| 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" |
| }, |
| ] |
| debuginfod = [ |
| { |
| url = "gs://fuchsia-artifacts/" |
| }, |
| { |
| url = "gs://fuchsia-public-artifacts-release/" |
| }, |
| ] |
| } |
| } |
| |
| # Generate symbol-index config for SDK. |
| generated_file("symbol-index-sdk-file") { |
| outputs = [ "$target_gen_dir/symbol-index-sdk.json" ] |
| |
| output_conversion = "json" |
| contents = { |
| build_id_dirs = [ |
| { |
| # The config will be located at $sdk/data/config/symbol-index*/config.json |
| # and the build id directory will be at $sdk/.build-id. |
| path = "../../../.build-id" |
| }, |
| ] |
| |
| debuginfod = [ |
| { |
| url = "gs://fuchsia-artifacts/" |
| }, |
| { |
| url = "gs://fuchsia-public-artifacts-release/" |
| }, |
| ] |
| } |
| } |
| |
| sdk_data("symbol-index-sdk") { |
| category = "partner" |
| name = "symbol_index" |
| file = "$target_gen_dir/symbol-index-sdk.json" |
| type = "config" |
| non_sdk_deps = [ ":symbol-index-sdk-file" ] |
| } |
| } |