| # 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/components.gni") |
| import("//build/host.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/rust/rustc_test.gni") |
| |
| rustc_library("routing") { |
| with_unit_tests = true |
| edition = "2021" |
| |
| visibility = [ |
| "//src/lib/assembly/component_id_index/*", |
| "//src/security/lib/scrutiny/plugins/*", |
| "//src/security/lib/scrutiny/x/*", |
| "//src/sys/component_manager/*", |
| "//src/sys/full-resolver:*", |
| "//src/sys/lib/cm_rust/testing:*", |
| "//src/sys/lib/component_debug/*", |
| "//src/sys/lib/elf_runner/*", |
| "//src/sys/lib/routing/*", |
| "//src/sys/test_manager/*", |
| "//tools/lib/cm_fidl_analyzer/*", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.component:fuchsia.component_rust", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust", |
| "//sdk/fidl/fuchsia.component.resolution:fuchsia.component.resolution_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//src/lib/error/clonable_error", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/from-enum", |
| "//src/lib/versioning/version-history/rust:version-history", |
| "//src/lib/zircon/rust:fuchsia-zircon-status", |
| "//src/sys/component_manager/lib/bedrock_error", |
| "//src/sys/lib/cm_config", |
| "//src/sys/lib/cm_moniker", |
| "//src/sys/lib/cm_rust", |
| "//src/sys/lib/cm_types", |
| "//src/sys/lib/component_id_index", |
| "//src/sys/lib/moniker", |
| "//src/sys/lib/routing/availability", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| "//third_party/rust_crates:url", |
| ] |
| |
| sources = [ |
| "src/availability.rs", |
| "src/capability_source.rs", |
| "src/collection.rs", |
| "src/component_instance.rs", |
| "src/config.rs", |
| "src/environment.rs", |
| "src/error.rs", |
| "src/event.rs", |
| "src/legacy_router.rs", |
| "src/lib.rs", |
| "src/mapper.rs", |
| "src/path.rs", |
| "src/policy.rs", |
| "src/resolving.rs", |
| "src/rights.rs", |
| "src/walk_state.rs", |
| ] |
| |
| test_deps = [ |
| "//src/sys/lib/cm_rust/testing", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| # 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("fuchsia-routing-tests") { |
| deps = [ |
| ":routing_test", |
| "//src/sys/test_runners:tmp_storage", |
| ] |
| } |
| |
| group("host-routing-tests") { |
| testonly = true |
| public_deps = [ ":routing_test($host_toolchain)" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fuchsia-routing-tests", |
| "availability:tests", |
| ] |
| } |