blob: 1050c00ca849e0aab91cc3a79531ef0a587167aa [file] [log] [blame]
# Copyright 2019 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("//src/connectivity/network/unified_binary/network_unified_binary.gni")
bin_base = {
edition = "2024"
deps = [
":lib",
"core:lib",
"//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_rust",
"//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust",
"//sdk/fidl/fuchsia.net.debug:fuchsia.net.debug_rust",
"//sdk/fidl/fuchsia.net.interfaces:fuchsia.net.interfaces_rust",
"//sdk/fidl/fuchsia.net.neighbor:fuchsia.net.neighbor_rust",
"//sdk/fidl/fuchsia.net.routes:fuchsia.net.routes_rust",
"//sdk/rust/zx",
"//src/connectivity/lib/net-types",
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fake-clock/named-timer",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/network/fidl_fuchsia_net_interfaces_ext",
"//src/lib/network/fidl_fuchsia_net_routes_ext",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:log",
]
sources = [
"src/eventloop.rs",
"src/main.rs",
]
non_rust_deps = []
}
network_unified_binary("bin") {
name = "reachability"
version = "0.1.0"
edition = "2024"
forward_variables_from(bin_base, "*")
with_unit_tests = true
test_deps = [
"//sdk/fidl/fuchsia.net:fuchsia.net_rust",
"//src/connectivity/lib/net-declare",
"//src/lib/fidl/rust/fidl",
"//third_party/rust_crates:assert_matches",
]
}
rustc_binary("bin_with_fake_time") {
name = "reachability_with_fake_time"
edition = "2024"
forward_variables_from(bin_base, "*")
testonly = true
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
non_rust_deps += [ "//src/lib/fake-clock/lib" ]
}
rustc_library("lib") {
name = "reachability_handler"
version = "0.1.0"
edition = "2024"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.net.reachability:fuchsia.net.reachability_rust",
"//src/lib/async-utils",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:log",
]
test_deps = [
"//src/lib/fidl/rust/fidl",
"//third_party/rust_crates:assert_matches",
]
sources = [ "src/lib.rs" ]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_unittest_package("reachability-handler-lib-test") {
deps = [ ":lib_test" ]
}
fuchsia_unittest_package("reachability-bin-test") {
deps = [ ":bin_test" ]
}
network_unified_binary_regular_and_gub_components("component") {
component_name = "reachability"
manifest = "meta/reachability.cml"
gub_deps = [ ":bin" ]
}
network_unified_binary_regular_and_gub_packages("package") {
package_name = "reachability"
gub_deps = [ ":component" ]
visibility = [ "//bundles/assembly/*" ]
}
fuchsia_component("component_with_fake_time") {
component_name = "reachability_with_fake_time"
manifest = "meta/reachability_with_fake_time.cml"
deps = [ ":bin_with_fake_time" ]
testonly = true
}
group("tests") {
testonly = true
deps = [
":reachability-bin-test",
":reachability-handler-lib-test",
"core:tests",
]
}