blob: be5588c73c9e940fc0c821774a5527ebaac1fb8e [file] [log] [blame]
# Copyright 2020 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")
import("//src/connectivity/network/unified_binary/network_unified_binary.gni")
rustc_library("lib") {
name = "dns"
with_unit_tests = true
edition = "2021"
deps = [
"//sdk/fidl/fuchsia.net:fuchsia.net_rust",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-sync",
"//src/lib/network/fidl_fuchsia_net_ext",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:trust-dns-proto",
"//third_party/rust_crates:trust-dns-resolver",
]
test_deps = [ "//src/connectivity/lib/net-declare" ]
sources = [
"src/async_resolver.rs",
"src/config.rs",
"src/lib.rs",
"src/tcp.rs",
"src/test_util.rs",
"src/udp.rs",
]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_component("dns_lib_test") {
testonly = true
manifest = "meta/dns_lib_test.cml"
deps = [ ":lib_test" ]
}
fuchsia_test_package("dns-tests") {
test_components = [ ":dns_lib_test" ]
deps = [ "//src/connectivity/network/netstack:component-debug" ]
}
bin_base = {
edition = "2021"
deps = [
":lib",
"//sdk/fidl/fuchsia.net:fuchsia.net_rust",
"//sdk/fidl/fuchsia.net.name:fuchsia.net.name_rust",
"//sdk/fidl/fuchsia.net.routes:fuchsia.net.routes_rust",
"//sdk/lib/scheduler/rust",
"//src/connectivity/lib/net-declare",
"//src/connectivity/lib/net-types",
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-sync",
"//src/lib/network/fidl_fuchsia_net_ext",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:libc",
"//third_party/rust_crates:tracing",
"//third_party/rust_crates:trust-dns-proto",
"//third_party/rust_crates:trust-dns-resolver",
"//third_party/rust_crates:unicode-xid",
]
test_deps = [
"//src/connectivity/lib/net-declare",
"//src/lib/const-unwrap",
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:test-case",
]
sources = [ "src/main.rs" ]
non_rust_deps = []
}
network_unified_binary("bin") {
edition = "2021"
forward_variables_from(bin_base, "*")
name = "dns_resolver"
with_unit_tests = true
}
rustc_binary("bin_with_fake_time") {
edition = "2021"
forward_variables_from(bin_base, "*")
name = "dns_resolver_with_fake_time"
testonly = true
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
non_rust_deps += [ "//src/lib/fake-clock/lib" ]
}
fuchsia_unittest_package("dns-resolver-tests") {
deps = [ ":bin_test" ]
}
network_unified_binary_regular_and_gub_components("component") {
component_name = "dns_resolver"
manifest = "meta/dns_resolver.cml"
gub_deps = [ ":bin" ]
}
network_unified_binary_regular_and_gub_packages("package") {
package_name = "dns-resolver"
gub_deps = [ ":component" ]
visibility = [ "//bundles/assembly/*" ]
}
fuchsia_component("component_with_fake_time") {
component_name = "dns_resolver_with_fake_time"
manifest = "meta/dns_resolver_with_fake_time.cml"
deps = [ ":bin_with_fake_time" ]
testonly = true
}
group("tests") {
testonly = true
deps = [
":dns-resolver-tests",
":dns-tests",
]
}