| # Copyright 2026 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/host.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| rustc_library("capability_source") { |
| with_unit_tests = true |
| edition = "2024" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2_rust", |
| "//src/lib/from-enum", |
| "//src/sys/lib/cm_rust", |
| "//src/sys/lib/cm_types", |
| "//src/sys/lib/moniker", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| test_deps = |
| [ "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust" ] |
| |
| sources = [ "src/lib.rs" ] |
| |
| # Some host tools use serde to serialize/deserialize types defined in |
| # this crate. 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:serde" ] |
| } |
| } |
| |
| fuchsia_unittest_package("capability_source_tests") { |
| deps = [ ":capability_source_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":capability_source_tests" ] |
| } |