blob: 148e6a18ad5ec31008d22dffd2afa9829caff525 [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/components.gni")
import("//build/rust/rustc_library.gni")
rustc_library("component_id_index") {
with_unit_tests = true
edition = "2021"
deps = [
"//sdk/fidl/fuchsia.component.internal:fuchsia.component.internal_rust",
"//src/lib/error/clonable_error",
"//src/lib/fidl/rust/fidl",
"//src/sys/lib/moniker",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:camino",
"//third_party/rust_crates:hex",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:thiserror",
]
test_deps = [
"//third_party/rust_crates:proptest",
"//third_party/rust_crates:test-case",
]
# Some host tools use serde to serialize/deserialize component_id_index types.
# This dependency is guarded in code via #[cfg(feature = "serde")] and
# #[cfg_attr(feature = "serde", ...)] to avoid deriving serde traits for error
# types for non-host builds.
features = []
if (is_host) {
deps += [
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json5",
]
test_deps += [ "//third_party/rust_crates:tempfile" ]
features += [ "serde" ]
}
sources = [
"src/fidl_convert.rs",
"src/instance_id.rs",
"src/lib.rs",
]
}
fuchsia_unittest_package("component-id-index-tests") {
deps = [ ":component_id_index_test" ]
}
group("host-component-id-index-tests") {
testonly = true
public_deps = [ ":component_id_index_test($host_toolchain)" ]
}
group("tests") {
testonly = true
deps = [
":component-id-index-tests",
":host-component-id-index-tests",
]
}