| # 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/rust/rustc_binary.gni") |
| |
| rustc_binary("bin") { |
| name = "netstack3" |
| edition = "2021" |
| with_unit_tests = true |
| |
| deps = [ |
| "core:netstack3-core", |
| "//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.interfaces:fuchsia.net.interfaces-rustc", |
| "//sdk/fidl/fuchsia.net.interfaces.admin:fuchsia.net.interfaces.admin-rustc", |
| "//sdk/fidl/fuchsia.net.stack:fuchsia.net.stack-rustc", |
| "//sdk/fidl/fuchsia.posix:fuchsia.posix-rustc", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket-rustc", |
| "//src/connectivity/lib/fidl_fuchsia_net_stack_ext", |
| "//src/connectivity/lib/net-types", |
| "//src/connectivity/lib/network-device/rust", |
| "//src/connectivity/lib/packet-formats", |
| "//src/connectivity/network/lib/explicit", |
| "//src/connectivity/network/lib/todo_unused", |
| "//src/lib/async-utils", |
| "//src/lib/const-unwrap", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/network/ethernet", |
| "//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/network/packet", |
| "//src/lib/zerocopy", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:byteorder", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:libc", |
| "//third_party/rust_crates:log", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ |
| "//src/connectivity/lib/net-declare", |
| "//src/connectivity/network/testing/netemul/network-context/fidl:network-rustc", |
| "//src/connectivity/network/testing/netemul/rust:lib", |
| "//src/lib/testing/fixture", |
| "//third_party/rust_crates:itertools", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| sources = [ |
| "src/bindings/context.rs", |
| "src/bindings/debug_fidl_worker.rs", |
| "src/bindings/devices.rs", |
| "src/bindings/ethernet_worker.rs", |
| "src/bindings/integration_tests.rs", |
| "src/bindings/interfaces_admin.rs", |
| "src/bindings/interfaces_watcher.rs", |
| "src/bindings/macros.rs", |
| "src/bindings/mod.rs", |
| "src/bindings/netdevice_worker.rs", |
| "src/bindings/socket/datagram.rs", |
| "src/bindings/socket/mod.rs", |
| "src/bindings/stack_fidl_worker.rs", |
| "src/bindings/timers.rs", |
| "src/bindings/util.rs", |
| "src/main.rs", |
| ] |
| |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| } |
| |
| fuchsia_component("component-legacy") { |
| component_name = "netstack3" |
| manifest = "meta/netstack3.cmx" |
| deps = [ |
| ":bin", |
| |
| # This component is only used for testing so ensure it doesn't show up in |
| # production builds. |
| "//build/validate:non_production_tag", |
| ] |
| } |
| |
| fuchsia_component("component") { |
| component_name = "netstack3" |
| manifest = "meta/netstack3.cml" |
| deps = [ ":bin" ] |
| } |
| |
| # Component that shows up in the package as #meta/netstack.cm and can be used |
| # in place of Netstack2 when assembling images. |
| fuchsia_component("component-dropin") { |
| component_name = "netstack" |
| manifest = "meta/netstack3.cml" |
| deps = [ ":bin" ] |
| } |
| |
| fuchsia_package("netstack3") { |
| deps = [ ":component-legacy" ] |
| } |
| |
| fuchsia_unittest_package("netstack3-tests") { |
| component_name = "netstack3-bin-test" |
| deps = [ |
| ":bin_test", |
| "//src/connectivity/network/testing/netemul/service:netemul-sandbox", |
| ] |
| } |
| |
| rustc_binary("netstack3-benchmarks") { |
| name = "netstack3_benchmarks" |
| testonly = true |
| edition = "2018" |
| sources = [ "bench/main.rs" ] |
| source_root = "bench/main.rs" |
| deps = [ |
| "core:netstack3-core-benchmarks", |
| "//src/developer/fuchsia-criterion", |
| ] |
| configs -= [ "//build/config/rust:allow_unused_results" ] |
| } |
| |
| fuchsia_package_with_single_component("netstack3_benchmarks") { |
| deps = [ ":netstack3-benchmarks" ] |
| testonly = true |
| manifest = "bench/meta/netstack3-benchmarks.cml" |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":netstack3", |
| ":netstack3-tests", |
| "core:tests", |
| ] |
| } |