| # Copyright 2024 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_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| rustc_library("lib") { |
| name = "socket_proxy" |
| with_unit_tests = true |
| edition = "2021" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.net:fuchsia.net_rust", |
| "//sdk/fidl/fuchsia.net.policy.properties:fuchsia.net.policy.properties_rust", |
| "//sdk/fidl/fuchsia.net.policy.socketproxy:fuchsia.net.policy.socketproxy_rust", |
| "//sdk/fidl/fuchsia.posix:fuchsia.posix_rust", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_rust", |
| "//sdk/fidl/fuchsia.posix.socket.raw:fuchsia.posix.socket.raw_rust", |
| "//src/lib/diagnostics/inspect/derive", |
| "//src/lib/diagnostics/inspect/runtime/rust:unchecked_includes", |
| "//src/lib/diagnostics/inspect/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-component", |
| "//src/lib/network/fidl_fuchsia_net_interfaces_ext", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| test_deps = [ |
| "testing", |
| "//src/connectivity/lib/net-declare", |
| "//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-component-test", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:pretty_assertions", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| sources = [ |
| "src/default_network_watcher.rs", |
| "src/dns_watcher.rs", |
| "src/lib.rs", |
| "src/registry.rs", |
| "src/socket_provider.rs", |
| ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| rustc_binary("socket_proxy") { |
| edition = "2021" |
| source_root = "src/bin/main.rs" |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia", |
| ] |
| |
| sources = [ "src/bin/main.rs" ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "network-socket-proxy" |
| manifest = "meta/network_socket_proxy.cml" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":socket_proxy" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "network-socket-proxy" |
| deps = [ ":component" ] |
| } |
| |
| fuchsia_unittest_package("socket-proxy-test") { |
| deps = [ ":lib_test" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":socket-proxy-test", |
| "integration:tests", |
| ] |
| } |