| # Copyright 2018 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") |
| |
| rustc_library("fuchsia-hyper") { |
| name = "fuchsia_hyper" |
| edition = "2021" |
| version = "0.1.0" |
| with_unit_tests = true |
| deps = [ |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:http", |
| "//third_party/rust_crates:hyper", |
| "//third_party/rust_crates:hyper-rustls", |
| "//third_party/rust_crates:lru-cache", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:rustls", |
| "//third_party/rust_crates:tokio", |
| ] |
| test_deps = [ |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:webpki", |
| ] |
| if (is_host) { |
| deps += [ |
| "//third_party/rust_crates:async-net", |
| "//third_party/rust_crates:rustls-native-certs", |
| "//third_party/rust_crates:tracing", |
| ] |
| test_deps += [ "//third_party/rust_crates:anyhow" ] |
| } else { |
| deps += [ |
| "//sdk/fidl/fuchsia.net.name:fuchsia.net.name_rust", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_rust", |
| "//src/lib/network/fidl_fuchsia_net_ext", |
| "//src/lib/webpki-roots-fuchsia", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/sys/lib/fidl-connector", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:pin-project", |
| "//third_party/rust_crates:socket2", |
| ] |
| test_deps += [ |
| "//src/lib/fidl/rust/fidl", |
| "//third_party/rust_crates:test-case", |
| ] |
| } |
| |
| sources = [ |
| "src/lib.rs", |
| "src/session_cache.rs", |
| ] |
| if (is_host) { |
| sources += [ "src/not_fuchsia.rs" ] |
| } else { |
| sources += [ |
| "src/fuchsia.rs", |
| "src/happy_eyeballs.rs", |
| ] |
| } |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_component("fuchsia-hyper-lib-test") { |
| testonly = true |
| manifest = "meta/fuchsia_hyper_lib_test.cml" |
| deps = [ ":fuchsia-hyper_test" ] |
| } |
| |
| fuchsia_test_package("fuchsia-hyper-tests") { |
| test_components = [ ":fuchsia-hyper-lib-test" ] |
| deps = [ "//src/connectivity/network/netstack:component" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fuchsia-hyper-tests", |
| ":fuchsia-hyper_test($host_toolchain)", |
| ] |
| } |