blob: 235033ee7a1ceeb019e1bc35d9f9733248eec1ff [file]
# 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") {
edition = "2024"
output_name = "bt_gap"
with_unit_tests = true
deps = [
":bt_gap_config",
"//sdk/fidl/fuchsia.bluetooth:fuchsia.bluetooth_rust",
"//sdk/fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr_rust",
"//sdk/fidl/fuchsia.bluetooth.gatt:fuchsia.bluetooth.gatt_rust",
"//sdk/fidl/fuchsia.bluetooth.gatt2:fuchsia.bluetooth.gatt2_rust",
"//sdk/fidl/fuchsia.bluetooth.host:fuchsia.bluetooth.host_rust",
"//sdk/fidl/fuchsia.bluetooth.le:fuchsia.bluetooth.le_rust",
"//sdk/fidl/fuchsia.bluetooth.sys:fuchsia.bluetooth.sys_rust",
"//sdk/fidl/fuchsia.device:fuchsia.device_rust",
"//sdk/fidl/fuchsia.stash:fuchsia.stash_rust",
"//sdk/rust/zx",
"//src/connectivity/bluetooth/lib/async-helpers",
"//src/connectivity/bluetooth/lib/fuchsia-bluetooth",
"//src/lib/async-utils",
"//src/lib/diagnostics/inspect/contrib/rust",
"//src/lib/diagnostics/inspect/runtime/rust",
"//src/lib/diagnostics/inspect/rust",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-sync",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:log",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:slab",
"//third_party/rust_crates:thiserror",
]
sources = [
"src/build_config.rs",
"src/generic_access_service.rs",
"src/host_device.rs",
"src/host_dispatcher.rs",
"src/main.rs",
"src/services/access.rs",
"src/services/address_lookup.rs",
"src/services/bootstrap.rs",
"src/services/configuration.rs",
"src/services/host_watcher.rs",
"src/services/mod.rs",
"src/services/pairing/mod.rs",
"src/services/pairing/pairing_dispatcher.rs",
"src/services/pairing/pairing_requests.rs",
"src/store/in_memory.rs",
"src/store/keys.rs",
"src/store/mod.rs",
"src/store/serde.rs",
"src/store/stash.rs",
"src/test/access.rs",
"src/test/address_lookup.rs",
"src/test/configuration.rs",
"src/test/discovery.rs",
"src/test/host_device.rs",
"src/test/host_dispatcher.rs",
"src/test/mod.rs",
"src/test/pairing.rs",
"src/test/receiver.rs",
"src/types.rs",
"src/watch_peers.rs",
]
test_deps = [
"//src/lib/diagnostics/testing/diagnostics-assertions/rust:diagnostics-assertions",
"//src/lib/test_util",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:proptest",
]
configs += [ "//build/config/rust/lints:deny_unused_results" ]
}
fuchsia_component_manifest("manifest") {
component_name = "bt-gap"
manifest = "meta/bt-gap.cml"
}
fuchsia_structured_config_rust_lib("bt_gap_config") {
cm_label = ":manifest"
}
fuchsia_structured_config_values("default_config_values") {
cm_label = ":manifest"
values = {
le_privacy = true
le_background_scanning = false
le_security_mode = "Mode1"
bredr_connectable = true
bredr_security_mode = "Mode4"
}
}
fuchsia_component("component") {
cm_label = ":manifest"
deps = [ ":bin" ]
}
fuchsia_test_component("test-stash-secure") {
deps = [ "//src/sys/stash:bin" ]
manifest = "meta/test-stash-secure.cml"
}
fuchsia_test_component("test-component") {
manifest = "meta/bt-gap-unittests.cml"
deps = [ ":bin_test" ]
}
fuchsia_test_package("bt-gap-unittests") {
# The max severity is set to ERROR due to expected ERROR messages in:
# - new_stash_fails_with_malformed_key_value_entry (ERROR with malformed string)
# - test_commit_bootstrap_doesnt_fail_from_host_failure (ERROR log is expected, should continue)
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
test_components = [ ":test-component" ]
deps = [
":default_config_values",
":test-stash-secure",
]
}
group("tests") {
testonly = true
deps = [ ":bt-gap-unittests" ]
}