blob: 153bab8708b1b4f65cec1cf64141926b23cd41f4 [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")
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/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:parking_lot",
"//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",
"//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/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:parking_lot",
"//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",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:itertools",
]
sources = [ "src/main.rs" ]
non_rust_deps = []
}
rustc_binary("bin") {
edition = "2021"
forward_variables_from(bin_base, "*")
name = "dns_resolver"
with_unit_tests = true
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
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") {
v2 = true
deps = [ ":bin_test" ]
}
fuchsia_component("component") {
component_name = "dns_resolver"
manifest = "meta/dns_resolver.cml"
deps = [ ":bin" ]
}
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",
]
}