| # 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/config.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| |
| rustc_library("lib") { |
| name = "netcfg" |
| with_unit_tests = true |
| edition = "2021" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.device:fuchsia.device-rustc", |
| "//sdk/fidl/fuchsia.hardware.ethernet:fuchsia.hardware.ethernet-rustc", |
| "//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//sdk/fidl/fuchsia.net:fuchsia.net-rustc", |
| "//sdk/fidl/fuchsia.net.debug:fuchsia.net.debug-rustc", |
| "//sdk/fidl/fuchsia.net.dhcp:fuchsia.net.dhcp-rustc", |
| "//sdk/fidl/fuchsia.net.dhcpv6:fuchsia.net.dhcpv6-rustc", |
| "//sdk/fidl/fuchsia.net.filter:fuchsia.net.filter-rustc", |
| "//sdk/fidl/fuchsia.net.interfaces:fuchsia.net.interfaces-rustc", |
| "//sdk/fidl/fuchsia.net.interfaces.admin:fuchsia.net.interfaces.admin-rustc", |
| "//sdk/fidl/fuchsia.net.name:fuchsia.net.name-rustc", |
| "//sdk/fidl/fuchsia.net.stack:fuchsia.net.stack-rustc", |
| "//sdk/fidl/fuchsia.net.virtualization:fuchsia.net.virtualization-rustc", |
| "//sdk/fidl/fuchsia.netstack:fuchsia.netstack-rustc", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle-rustc", |
| "//src/connectivity/bluetooth/lib/async-helpers", |
| "//src/connectivity/lib/fidl_fuchsia_net_stack_ext", |
| "//src/connectivity/lib/net-declare", |
| "//src/connectivity/network/dhcp:lib", |
| "//src/connectivity/network/lib/dns_server_watcher", |
| "//src/connectivity/network/lib/netfilter", |
| "//src/lib/async-utils", |
| "//src/lib/diagnostics/log/rust", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-fs", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/network/fidl_fuchsia_hardware_ethernet_ext", |
| "//src/lib/network/fidl_fuchsia_net_ext", |
| "//src/lib/network/fidl_fuchsia_net_interfaces_ext", |
| "//src/lib/storage/fuchsia-vfs-watcher", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:parking_lot", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:test-case", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ "//src/lib/testing/fixture" ] |
| |
| sources = [ |
| "src/devices.rs", |
| "src/dhcpv4.rs", |
| "src/dhcpv6.rs", |
| "src/dns.rs", |
| "src/errors.rs", |
| "src/interface.rs", |
| "src/lib.rs", |
| "src/virtualization.rs", |
| ] |
| |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| } |
| |
| rustc_binary("bin-basic") { |
| edition = "2021" |
| name = "netcfg_basic" |
| source_root = "src/bin/basic.rs" |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:anyhow", |
| ] |
| |
| sources = [ "src/bin/basic.rs" ] |
| |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| } |
| |
| rustc_binary("bin-advanced") { |
| edition = "2021" |
| name = "netcfg_advanced" |
| source_root = "src/bin/advanced.rs" |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia-async", |
| "//third_party/rust_crates:anyhow", |
| ] |
| |
| sources = [ "src/bin/advanced.rs" ] |
| |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| } |
| |
| fuchsia_component("component-basic") { |
| component_name = "netcfg-basic" |
| manifest = "meta/netcfg-basic.cml" |
| deps = [ ":bin-basic" ] |
| } |
| |
| # TODO(https://fxbug.dev/85450): use product assembly to include this as the |
| # `netcfg` in the core product. |
| fuchsia_component("component-advanced") { |
| component_name = "netcfg-advanced" |
| manifest = "meta/netcfg-advanced.cml" |
| deps = [ ":bin-advanced" ] |
| } |
| |
| config_data("config-default") { |
| for_pkg = "netcfg" |
| sources = [ "config/default.json" ] |
| outputs = [ "default.json" ] |
| } |
| |
| config_data("config-no-ssh-over-wlan") { |
| for_pkg = "netcfg" |
| sources = [ "config/no_ssh_over_wlan.json" ] |
| outputs = [ "default.json" ] |
| } |
| |
| config_data("config-prefer-wired") { |
| for_pkg = "netcfg" |
| sources = [ "config/prefer_wired.json" ] |
| outputs = [ "default.json" ] |
| } |
| |
| fuchsia_unittest_package("netcfg-tests") { |
| deps = [ ":lib_test" ] |
| manifest = "meta/netcfg_lib_test.cml" |
| } |
| |
| # TODO(https://fxbug.dev/85450): remove this group once the advanced variant of |
| # netcfg is included in the core product build. |
| group("compile") { |
| deps = [ ":component-advanced" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":compile", |
| ":netcfg-tests", |
| ] |
| } |