| # 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/rust/rustc_library.gni") |
| |
| assert(is_host, "only host is supported") |
| |
| rustc_library("lib") { |
| name = "ffx_target_net" |
| version = "0.1.0" |
| edition = "2024" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.developer.remotecontrol:fuchsia.developer.remotecontrol_rust", |
| "//sdk/fidl/fuchsia.posix:fuchsia.posix_rust", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_rust", |
| "//src/developer/ffx/lib/netext:lib", |
| "//src/developer/ffx/lib/rcs:lib", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/network/fidl_fuchsia_net_ext", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:scopeguard", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tokio", |
| ] |
| |
| sources = [ |
| "src/error.rs", |
| "src/lib.rs", |
| "src/port_forwarder.rs", |
| "src/socket_provider.rs", |
| ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| rustc_library("testutil") { |
| name = "ffx_target_net_testutil" |
| version = "0.1.0" |
| edition = "2024" |
| with_unit_tests = true |
| testonly = true |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.posix:fuchsia.posix_rust", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-hyper", |
| "//src/lib/network/fidl_fuchsia_net_ext", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:http", |
| "//third_party/rust_crates:hyper", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:scopeguard", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tokio", |
| ] |
| |
| sources = [ |
| "testutil/fake_netstack.rs", |
| "testutil/hyper_connector.rs", |
| "testutil/lib.rs", |
| ] |
| source_root = "testutil/lib.rs" |
| |
| test_deps = [ |
| "//src/lib/fuchsia", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| group("target_net") { |
| testonly = true |
| |
| deps = [ |
| ":lib", |
| ":tests", |
| ":testutil", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":testutil_test" ] |
| } |
| |
| group("host_tests") { |
| testonly = true |
| deps = [ "tests:host_tests" ] |
| } |