blob: 28874c2e5598d79854c08e7969b12cc5e2814c53 [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("//src/connectivity/network/use_netstack3.gni")
import("//src/sys/core/build/core_shard.gni")
declare_args() {
enable_netstack2_tracing = false
}
_netstack_package = ":netstack2"
_netstack2_component = "netstack:component"
assert(!(enable_netstack2_tracing && use_netstack3),
"cannot enable both Netstack3 and tracing in Netstack2")
if (use_netstack3) {
_netstack_package = ":netstack3"
}
if (enable_netstack2_tracing) {
_netstack2_component = "netstack:component-with-tracing"
}
fuchsia_component("component") {
component_name = "network"
manifest = "meta/network-default.cml"
}
# TODO(https://fxbug.dev/85450): use subassembly-based product assembly to
# assemble the network realm from shards depending on the product, rather than
# creating two separate component manifests and relying on include shards to
# reduce duplication.
fuchsia_component("component-basic") {
component_name = "network"
manifest = "meta/network-basic.cml"
}
# Defines a Fuchsia package with networking components.
#
# Parameters
#
# basic:
# Required: Use only the basic versions of components.
#
# visibility:
# Optional: Has the standard GN meaning.
template("network_package") {
fuchsia_package(target_name) {
forward_variables_from(invoker, [ "visibility" ])
package_name = "network"
deps = [
"dhcpv4/server:component",
"dhcpv6/client:component",
"dns:component",
"http-client:component",
"reachability:component",
]
if (invoker.basic) {
deps += [
":component-basic",
"netcfg:component-basic",
]
} else {
deps += [
":component",
"netcfg:component-advanced",
]
}
}
}
# Enabling a soft-transition, remove when complete
# TODO(122864) Remove transitional labels
group("for_transition") {
public_deps = [ ":network" ]
}
network_package("network") {
basic = false
}
# Enabling a soft-transition, remove when complete
# TODO(122864) Remove transitional labels
group("basic-for_transition") {
public_deps = [ ":network-basic" ]
}
network_package("network-basic") {
basic = true
}
fuchsia_package("netstack2") {
package_name = "netstack"
deps = [ _netstack2_component ]
visibility = [
":*",
"//bundles/assembly:*",
]
}
fuchsia_package("netstack3") {
package_name = "netstack"
deps = [
# TODO(https://fxbug.dev/125773): Move this component out of this package
# and into the network package once both Netstack2 and Netstack3 are using
# the component for all DHCPv4 functionality.
"dhcpv4/client/bindings:component",
"netstack3:component-dropin",
]
visibility = [
":*",
"//bundles/assembly:*",
]
}
core_shard("virtualization-core-shard") {
shard_file = "meta/virtualization.core_shard.cml"
}
core_shard("persistence-core-shard") {
shard_file = "meta/persistence.core_shard.cml"
}
# TODO(https://fxbug.dev/104268): Remove from all base package sets
# and replace with a testing package included in the universe package
# set.
fuchsia_package("network-legacy-deprecated") {
testonly = true
deps = [
"dns:component",
"netstack:component",
"netstack:component-with-fast-udp",
"netstack3:component-debug",
]
}
group("drivers") {
deps = [ "drivers/network-device" ]
}
group("tests") {
testonly = true
deps = [
"dhcpv4:tests",
"dhcpv6:tests",
"dns:tests",
"drivers:tests",
"http-client:tests",
"lib:tests",
"mdns:tests",
"net-cli:tests",
"netcfg:tests",
"netlink:tests",
# Ensure this target doesn't rot. This dependency can be removed if the
# target becomes load bearing elsewhere.
"netstack:component-with-tracing",
"netstack:tests",
"netstack3:tests",
"reachability:tests",
"testing:tests",
"tests",
"tools:tests",
"tun:tests",
]
}