| # 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/package.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| rustc_library("lib") { |
| name = "dhcp" |
| with_unit_tests = true |
| edition = "2018" |
| deps = [ |
| "//garnet/lib/rust/fidl_fuchsia_hardware_ethernet_ext", |
| "//garnet/lib/rust/fidl_fuchsia_net_ext", |
| "//garnet/lib/rust/never", |
| "//sdk/fidl/fuchsia.net.dhcp:fuchsia.net.dhcp-rustc", |
| "//sdk/fidl/fuchsia.stash:fuchsia.stash-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:bytes", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:num-derive", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| "//zircon/system/fidl/fuchsia-net:fuchsia-net-rustc", |
| ] |
| } |
| |
| test_package("dhcp-tests") { |
| deps = [ ":lib_test" ] |
| |
| tests = [ |
| { |
| name = "dhcp_lib_test" |
| environments = [ qemu_env ] |
| }, |
| ] |
| } |
| |
| rustc_binary("bin") { |
| name = "dhcpd" |
| with_unit_tests = true |
| edition = "2018" |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.net.dhcp:fuchsia.net.dhcp-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:getopts", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:net2", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:void", |
| "//zircon/system/fidl/fuchsia-net:fuchsia-net-rustc", |
| ] |
| |
| test_deps = [ |
| "//sdk/fidl/fuchsia.stash:fuchsia.stash-rustc", |
| "//third_party/rust_crates:matches", |
| "//third_party/rust_crates:rand", |
| ] |
| } |
| |
| package("dhcpd") { |
| deps = [ ":bin" ] |
| meta = [ |
| { |
| path = rebase_path("meta/dhcpd.cmx") |
| dest = "dhcpd.cmx" |
| }, |
| ] |
| resources = [ |
| { |
| path = rebase_path("data/default_config.json") |
| dest = "config.json" |
| }, |
| ] |
| binaries = [ |
| { |
| name = "dhcpd" |
| }, |
| ] |
| } |
| |
| package("dhcpd-testing") { |
| testonly = true |
| deps = [ ":bin" ] |
| meta = [ |
| { |
| path = rebase_path("meta/dhcpd.cmx") |
| dest = "dhcpd-testing.cmx" |
| }, |
| ] |
| resources = [ |
| { |
| path = rebase_path("data/default_config.json") |
| dest = "default_config.json" |
| }, |
| { |
| path = rebase_path("data/test_config.json") |
| dest = "test_config.json" |
| }, |
| { |
| path = rebase_path("data/bound_device_test_config_eth2.json") |
| dest = "bound_device_test_config_eth2.json" |
| }, |
| { |
| path = rebase_path("data/bound_device_test_config_eth3.json") |
| dest = "bound_device_test_config_eth3.json" |
| }, |
| ] |
| binaries = [ |
| { |
| name = "dhcpd" |
| }, |
| ] |
| } |
| |
| test_package("dhcpd-tests") { |
| deps = [ ":bin_test" ] |
| |
| tests = [ |
| { |
| name = "dhcpd_bin_test" |
| environments = [ qemu_env ] |
| }, |
| ] |
| } |
| |
| group("dhcp") { |
| public_deps = [ |
| ":dhcpd", |
| "//src/connectivity/network/dhcp/config", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":dhcp-tests", |
| ":dhcpd-tests", |
| ] |
| } |