blob: 5f086267759183f8582a620ee63e04f1c58dc7ec [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/sys/core/build/core_shard.gni")
declare_args() {
# DO NOT SET THIS IN A PRODUCT DEFINITION!! FOR NETSTACK DEVELOPER USE ONLY
# TODO(https://fxbug.dev/85450) - Convert this to a platform configuration
# option in Product Assembly
use_netstack3 = false
}
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"
}
# TODO(https://fxbug.dev/85450): Convert this to a platform configuration
# option in Product Assembly
group("network") {
if (use_netstack3) {
public_deps = [ ":network_netstack3" ]
} else {
public_deps = [ ":network_netstack2" ]
}
}
# Defines a Fuchsia package with networking components.
#
# Parameters
#
# netstack_component:
# Required: Name of the Fuchsia component target that provides the netstack.
#
# 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 = [
"dhcp:component",
"dhcpv6/client:component",
"dns:component",
"http-client:component",
"reachability:component",
invoker.netstack_component,
]
if (invoker.basic) {
deps += [
":component-basic",
"netcfg:component-basic",
]
} else {
deps += [
":component",
"netcfg:component-advanced",
]
}
}
}
network_package("network_netstack2") {
netstack_component = "netstack:component"
basic = false
# Other targets should depend on this via the :network group.
visibility = [ ":network" ]
}
network_package("network_netstack3") {
netstack_component = "netstack3:component-dropin"
basic = false
# Other targets should depend on this via the :network group.
visibility = [ ":network" ]
}
network_package("network-basic") {
netstack_component = "netstack:component"
basic = true
}
# TODO(https://fxbug.dev/85450): use subassembly-based product assembly to
# create this variant.
network_package("network-with-tracing") {
netstack_component = "netstack:component-with-tracing"
basic = false
}
core_shard("virtualization-core-shard") {
shard_file = "meta/virtualization.core_shard.cml"
}
# TODO(https://fxbug.dev/85821): Remove once out-of-tree users no longer
# reference v1 components.
fuchsia_package("network-legacy-deprecated") {
deps = [
"dns:component-legacy",
"netstack:component-legacy",
"netstack:component-with-fast-udp-legacy",
"netstack3:component-legacy",
]
}
# TODO(https://fxbug.dev/85742): Remove this target once out-of-tree
# integration tests inject components from network-legacy-deprecated.
group("integration-test-deps") {
deps = [ "netstack" ]
}
group("drivers") {
deps = [ "drivers/network-device" ]
}
group("tests") {
testonly = true
deps = [
"dhcp:tests",
"dhcpv6:tests",
"dns:tests",
"drivers:tests",
"http-client:tests",
"lib:tests",
"mdns:tests",
"net-cli:tests",
"netcfg: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",
]
}