| # 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") |
| import("//build/rust/rustc_test.gni") |
| |
| rustc_library("moniker") { |
| with_unit_tests = true |
| edition = "2021" |
| |
| visibility = [ |
| "//src/developer/ffx/plugins/component/*", |
| "//src/developer/ffx/plugins/inspect/*", |
| "//src/developer/ffx/plugins/log/*", |
| "//src/developer/ffx/tools/playground/*", |
| "//src/developer/remote-control/*", |
| "//src/diagnostics/archivist/*", |
| "//src/diagnostics/iquery/*", |
| "//src/diagnostics/lib/log-command/*", |
| "//src/diagnostics/persistence/*", |
| "//src/lib/assembly/component_id_index/*", |
| "//src/lib/diagnostics/data/rust/*", |
| "//src/lib/diagnostics/selectors/*", |
| "//src/security/lib/scrutiny/*", |
| "//src/sys/component_manager/*", |
| "//src/sys/lib/cm_config/*", |
| "//src/sys/lib/cm_moniker/*", |
| "//src/sys/lib/component-events/*", |
| "//src/sys/lib/component_debug/*", |
| "//src/sys/lib/component_id_index/*", |
| "//src/sys/lib/elf_runner/*", |
| "//src/sys/lib/moniker/*", |
| "//src/sys/lib/routing/*", |
| "//src/sys/run_test_suite/*", |
| "//src/sys/test_manager/*", |
| "//src/sys/tools/*", |
| "//src/testing/sl4f/*", |
| "//tools/component_id_index/*", |
| "//tools/lib/cm_fidl_analyzer/*", |
| ] |
| |
| deps = [ |
| "//src/sys/lib/cm_rust", |
| "//src/sys/lib/cm_types", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ |
| "src/child_name.rs", |
| "src/error.rs", |
| "src/extended_moniker.rs", |
| "src/lib.rs", |
| "src/moniker.rs", |
| ] |
| |
| # Some host tools use serde to serialize/deserialize moniker types. This |
| # dependency is guarded in code via #[cfg(feature = "serde")] and |
| # #[cfg_attr(feature = "serde", ...)] to prevent serde dependencies in |
| # non-host builds. |
| features = [] |
| if (is_host) { |
| features += [ "serde" ] |
| deps += [ |
| "//third_party/rust_crates:schemars", |
| "//third_party/rust_crates:serde", |
| ] |
| sources += [ "src/serde_ext.rs" ] |
| } |
| } |
| |
| fuchsia_unittest_package("moniker-tests") { |
| deps = [ ":moniker_test" ] |
| } |