blob: dfd81bd340425bdf0f7db6e45e911388331b48f9 [file] [log] [blame]
# 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/fuzz.gni")
import("//build/rust/rustc_binary.gni")
import("//build/rust/rustc_fuzzer.gni")
import("//build/rust/rustc_library.gni")
import("//src/sys/core/build/core_shard.gni")
import("//third_party/cobalt/metrics_registry.gni")
declare_args() {
# Selects the wlan configuration type to use. Choices:
# "client" - client mode
# "ap" - access point mode
# "" (empty string) - no configuration
wlancfg_config_type = "client"
}
rustc_library("lib") {
edition = "2021"
name = "wlancfg_lib"
with_unit_tests = true
deps = [
":wlan_metrics_registry_rustlib",
"//sdk/fidl/fuchsia.location.namedplace:fuchsia.location.namedplace_rust",
"//sdk/fidl/fuchsia.location.sensor:fuchsia.location.sensor_rust",
"//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust",
"//sdk/fidl/fuchsia.power.clientlevel:fuchsia.power.clientlevel_rust",
"//sdk/fidl/fuchsia.wlan.common:fuchsia.wlan.common_rust",
"//sdk/fidl/fuchsia.wlan.device.service:fuchsia.wlan.device.service_rust",
"//sdk/fidl/fuchsia.wlan.ieee80211:fuchsia.wlan.ieee80211_rust",
"//sdk/fidl/fuchsia.wlan.internal:fuchsia.wlan.internal_rust",
"//sdk/fidl/fuchsia.wlan.policy:fuchsia.wlan.policy_rust",
"//sdk/fidl/fuchsia.wlan.policy:measure_tape_for_scan_result",
"//sdk/fidl/fuchsia.wlan.product.deprecatedclient:fuchsia.wlan.product.deprecatedclient_rust",
"//sdk/fidl/fuchsia.wlan.product.deprecatedconfiguration:fuchsia.wlan.product.deprecatedconfiguration_rust",
"//sdk/fidl/fuchsia.wlan.sme:fuchsia.wlan.sme_rust",
"//sdk/fidl/fuchsia.wlan.stats:fuchsia.wlan.stats_rust",
"//src/connectivity/wlan/lib/common/rust/:wlan-common",
"//src/connectivity/wlan/lib/ieee80211",
"//src/connectivity/wlan/lib/stash/:wlan-stash",
"//src/lib/diagnostics/inspect/contrib/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-sync",
"//src/lib/windowed-stats",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/cobalt/src/lib/client/rust:cobalt-client",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:arbitrary",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:lazy_static",
"//third_party/rust_crates:num-traits",
"//third_party/rust_crates:paste",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:static_assertions",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
test_deps = [
"//sdk/fidl/fuchsia.net:fuchsia.net_rust",
"//sdk/fidl/fuchsia.stash:fuchsia.stash_rust",
"//sdk/fidl/fuchsia.wlan.common.security:fuchsia.wlan.common.security_rust",
"//src/connectivity/wlan/lib/ieee80211-testutils",
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//src/lib/fuchsia",
"//src/lib/test_util",
"//third_party/rust_crates:hex",
"//third_party/rust_crates:regex",
"//third_party/rust_crates:test-case",
]
sources = [
"src/access_point/mod.rs",
"src/access_point/state_machine.rs",
"src/access_point/types.rs",
"src/client/connection_selection/bss_selection.rs",
"src/client/connection_selection/mod.rs",
"src/client/connection_selection/network_selection.rs",
"src/client/connection_selection/scoring_functions.rs",
"src/client/mod.rs",
"src/client/roaming/lib.rs",
"src/client/roaming/local_roam_manager/mod.rs",
"src/client/roaming/mod.rs",
"src/client/roaming/roam_monitor/mod.rs",
"src/client/scan/fidl_conversion.rs",
"src/client/scan/mod.rs",
"src/client/scan/queue.rs",
"src/client/state_machine.rs",
"src/client/types.rs",
"src/config_management/config_manager.rs",
"src/config_management/mod.rs",
"src/config_management/network_config.rs",
"src/config_management/stash_conversion.rs",
"src/legacy/deprecated_client.rs",
"src/legacy/deprecated_configuration.rs",
"src/legacy/mod.rs",
"src/lib.rs",
"src/mode_management/device_monitor.rs",
"src/mode_management/iface_manager.rs",
"src/mode_management/iface_manager_api.rs",
"src/mode_management/iface_manager_types.rs",
"src/mode_management/low_power_manager.rs",
"src/mode_management/mod.rs",
"src/mode_management/phy_manager.rs",
"src/mode_management/recovery.rs",
"src/regulatory_manager.rs",
"src/telemetry/convert.rs",
"src/telemetry/experiment.rs",
"src/telemetry/inspect_time_series.rs",
"src/telemetry/mod.rs",
"src/telemetry/windowed_stats.rs",
"src/tests/client_e2e.rs",
"src/tests/mod.rs",
"src/util/atomic_oneshot_stream.rs",
"src/util/fuse_pending.rs",
"src/util/future_with_metadata.rs",
"src/util/historical_list.rs",
"src/util/listener/access_point.rs",
"src/util/listener/client.rs",
"src/util/listener/generic.rs",
"src/util/listener/mod.rs",
"src/util/mod.rs",
"src/util/pseudo_energy.rs",
"src/util/state_machine.rs",
"src/util/testing/async_stream.rs",
"src/util/testing/fakes.rs",
"src/util/testing/generate_struct.rs",
"src/util/testing/mod.rs",
]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
configs += [ "//build/config/rust/lints:clippy_warn_all" ]
}
rustc_binary("bin") {
name = "wlancfg"
edition = "2021"
deps = [
":lib",
":wlancfg-config",
"//sdk/fidl/fuchsia.location.namedplace:fuchsia.location.namedplace_rust",
"//sdk/fidl/fuchsia.metrics:fuchsia.metrics_rust",
"//sdk/fidl/fuchsia.power.clientlevel:fuchsia.power.clientlevel_rust",
"//sdk/fidl/fuchsia.wlan.common:fuchsia.wlan.common_rust",
"//sdk/fidl/fuchsia.wlan.device.service:fuchsia.wlan.device.service_rust",
"//sdk/fidl/fuchsia.wlan.policy:fuchsia.wlan.policy_rust",
"//src/connectivity/wlan/lib/trace:wlan-trace",
"//src/diagnostics/persistence/fidl:persist_rust",
"//src/lib/diagnostics/inspect/contrib/rust",
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/diagnostics/log/rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/trace/rust:trace-provider",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:tracing",
]
sources = [ "src/main.rs" ]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_component_manifest("wlancfg-manifest") {
component_name = "wlancfg"
manifest = "meta/wlancfg.cml"
}
fuchsia_structured_config_rust_lib("wlancfg-config") {
cm_label = ":wlancfg-manifest"
}
fuchsia_component("service") {
cm_label = ":wlancfg-manifest"
deps = [ ":bin" ]
}
# Enabling a soft-transition, remove when complete
# TODO(122864) Remove transitional labels
group("for_transition") {
public_deps = [ ":wlancfg" ]
}
fuchsia_package("wlancfg") {
deps = [ ":service" ]
}
fuchsia_component("wlancfg_lib_test") {
testonly = true
manifest = "meta/wlancfg_lib_test.cml"
deps = [ ":lib_test" ]
}
fuchsia_test_package("wlancfg-tests") {
test_components = [ ":wlancfg_lib_test" ]
deps = [ "//src/sys/stash:stash_secure_v2" ]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
metrics_registry("wlan_metrics_registry") {
# This must match the ID of our Cobalt project as specified in:
# //third_party/cobalt_config/projects.yaml
project_id = 3708719327
generate_rust = true # Generates a rust target with '_rustlib' appended
}
rustc_fuzzer("fuzz_saved_networks_manager_store") {
edition = "2021"
source_root = "fuzz/src/lib.rs"
rustfunction = "fuzz_saved_networks_manager_store"
sources = [ "fuzz/src/lib.rs" ]
deps = [
":lib",
"//src/connectivity/wlan/lib/common/rust/:wlan-common",
"//src/connectivity/wlan/lib/stash/:wlan-stash",
"//src/lib/fuzzing/rust:fuzz",
"//third_party/rust_crates:arbitrary",
"//third_party/rust_crates:futures",
]
}
fuchsia_fuzzer_component("fuzz-saved-networks-manager-store-component") {
manifest = "meta/fuzz_saved_networks_manager_store.cml"
deps = [ ":fuzz_saved_networks_manager_store" ]
}
fuchsia_fuzzer_package("wlancfg-fuzzers") {
rust_fuzzer_components = [ ":fuzz-saved-networks-manager-store-component" ]
}
group("tests") {
testonly = true
deps = [
":wlancfg-fuzzers",
":wlancfg-tests",
]
}