| # 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/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/fuzz.gni") |
| import("//build/packages/prebuilt_package.gni") |
| import("//src/connectivity/bluetooth/core/bt-host/build/bt_gtest_package.gni") |
| |
| source_set("sources") { |
| sources = [ |
| "host.cc", |
| "host.h", |
| "util.cc", |
| "util.h", |
| ] |
| |
| deps = [ |
| "//sdk/lib/device-watcher/cpp", |
| "//src/connectivity/bluetooth/core/bt-host/common", |
| "//src/connectivity/bluetooth/core/bt-host/controllers", |
| "//src/connectivity/bluetooth/core/bt-host/gap", |
| "//src/connectivity/bluetooth/core/bt-host/gatt", |
| "//third_party/pigweed/backends/pw_async_fuchsia:dispatcher", |
| "//third_party/pigweed/backends/pw_random:zircon_random_generator", |
| "//zircon/system/ulib/inspect", |
| ] |
| |
| public_deps = [ |
| ":bt_host_config", |
| ":stack", |
| "fidl", |
| "//sdk/banjo/fuchsia.hardware.bt.vendor:fuchsia.hardware.bt.vendor_banjo_cpp", |
| "//sdk/fidl/fuchsia.bluetooth.host:fuchsia.bluetooth.host_hlcpp", |
| "//sdk/fidl/fuchsia.hardware.bluetooth:fuchsia.hardware.bluetooth_cpp", |
| "//sdk/fidl/fuchsia.process.lifecycle:fuchsia.process.lifecycle_hlcpp", |
| "//sdk/lib/fit", |
| "//sdk/lib/sys/cpp", |
| "//src/connectivity/bluetooth/lib/fidl", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| executable("bin") { |
| output_name = "bt_host" |
| sources = [ "main.cc" ] |
| deps = [ |
| ":sources", |
| "//third_party/pigweed/backends/pw_log:syslog", |
| ] |
| } |
| |
| config("config_enable_inspect") { |
| defines = [ "PW_BLUETOOTH_SAPPHIRE_INSPECT_ENABLED" ] |
| } |
| |
| config("config_enable_trace") { |
| defines = [ "PW_BLUETOOTH_SAPPHIRE_TRACE_ENABLED" ] |
| } |
| |
| group("config") { |
| public_configs = [ |
| ":config_enable_inspect", |
| ":config_enable_trace", |
| ] |
| } |
| |
| fuchsia_component_manifest("manifest") { |
| component_name = "bt-host" |
| manifest = "meta/bt-host.cml" |
| } |
| |
| fuchsia_structured_config_cpp_elf_lib("bt_host_config") { |
| cm_label = ":manifest" |
| } |
| |
| fuchsia_structured_config_values("default_config_values") { |
| cm_label = ":manifest" |
| values = { |
| device_path = "/dev/class/bt-hci/000" |
| } |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| # This is the OOT built bt-host component. |
| # See https://pigweed.dev/pw_bluetooth_sapphire/. |
| # TODO(https://fxbug.dev/324107025): Rename this target to "bt-host" and update |
| # `//build:non_hermetic_deps` once it's fully migrated OOT. |
| prebuilt_package("bt-host-oot") { |
| # component-url: fuchsia-pkg://fuchsia.com/bt-host#meta/bt-host.cm |
| package_name = "bt-host" |
| archive = "//prebuilt/connectivity/bluetooth/bt-host/$target_cpu/bt-host" |
| } |
| |
| fuchsia_package("bt-host") { |
| deps = [ |
| # component-url: fuchsia-pkg://fuchsia.com/bt-host#meta/bt-host.cm |
| ":component", |
| ":default_config_values", |
| ] |
| } |
| |
| group("stack") { |
| public_deps = [ |
| "att", |
| "common", |
| "controllers", |
| "gap", |
| "gatt", |
| "hci", |
| "hci-spec", |
| "iso", |
| "l2cap", |
| "sco", |
| "sdp", |
| "sm", |
| "socket", |
| "transport", |
| ] |
| } |
| |
| # See https://fuchsia.dev/fuchsia-src/development/testing/fuzzing/build-a-fuzzer?hl=en#fx-set |
| # for instructions on building the fuzzers package. |
| fuchsia_fuzzer_component("advertising-data-fuzzer-component") { |
| manifest = "common/meta/advertising_data_fuzzer.cml" |
| deps = [ "common:advertising_data_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("host-server-watch-peers-fuzzer-component") { |
| manifest = "fidl/meta/host_server_watch_peers_fuzzer.cml" |
| deps = [ "fidl:host_server_watch_peers_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("peer-cache-fuzzer-component") { |
| manifest = "gap/meta/peer_cache_fuzzer.cml" |
| deps = [ "gap:peer_cache_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("l2cap-fuzzer-component") { |
| manifest = "l2cap/meta/l2cap_fuzzer.cml" |
| deps = [ "l2cap:l2cap_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("basic-mode-rx-engine-fuzzer-component") { |
| manifest = "l2cap/meta/basic_mode_rx_engine_fuzzer.cml" |
| deps = [ "l2cap:basic_mode_rx_engine_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component( |
| "enhanced-retransmission-mode-engines-fuzzer-component") { |
| manifest = "l2cap/meta/enhanced_retransmission_mode_engines_fuzzer.cml" |
| deps = [ "l2cap:enhanced_retransmission_mode_engines_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("bredr-dynamic-channel-registry-fuzzer-component") { |
| manifest = "l2cap/meta/bredr_dynamic_channel_registry_fuzzer.cml" |
| deps = [ "l2cap:bredr_dynamic_channel_registry_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("channel-configuration-fuzzer-component") { |
| manifest = "l2cap/meta/channel_configuration_fuzzer.cml" |
| deps = [ "l2cap:channel_configuration_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("common-handler-fuzzer-component") { |
| manifest = "l2cap/meta/common_handler_fuzzer.cml" |
| deps = [ "l2cap:common_handler_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("data-element-fuzzer-component") { |
| manifest = "sdp/meta/data_element_fuzzer.cml" |
| deps = [ "sdp:data_element_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("pdu-fuzzer-component") { |
| manifest = "sdp/meta/pdu_fuzzer.cml" |
| deps = [ "sdp:pdu_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_component("valid-packet-reader-fuzzer-component") { |
| manifest = "sm/meta/valid_packet_reader_fuzzer.cml" |
| deps = [ "sm:valid_packet_reader_fuzzer" ] |
| } |
| |
| fuchsia_fuzzer_package("fuzzers") { |
| package_name = "bt-host-fuzzers" |
| cpp_fuzzer_components = [ |
| ":advertising-data-fuzzer-component", |
| ":host-server-watch-peers-fuzzer-component", |
| ":peer-cache-fuzzer-component", |
| ":l2cap-fuzzer-component", |
| ":basic-mode-rx-engine-fuzzer-component", |
| ":enhanced-retransmission-mode-engines-fuzzer-component", |
| ":bredr-dynamic-channel-registry-fuzzer-component", |
| ":channel-configuration-fuzzer-component", |
| ":common-handler-fuzzer-component", |
| ":data-element-fuzzer-component", |
| ":pdu-fuzzer-component", |
| ":valid-packet-reader-fuzzer-component", |
| ] |
| } |
| |
| source_set("device_tests") { |
| testonly = true |
| |
| sources = [ "host_test.cc" ] |
| |
| deps = [ |
| ":sources", |
| "//src/connectivity/bluetooth/core/bt-host/testing", |
| "//src/lib/testing/loop_fixture", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| source_set("component_tests") { |
| testonly = true |
| |
| sources = [ "host_test.cc" ] |
| |
| deps = [ |
| ":sources", |
| "//src/connectivity/bluetooth/core/bt-host/fidl:fake_hci_test_fixture", |
| "//src/connectivity/bluetooth/core/bt-host/testing", |
| "//src/lib/testing/loop_fixture", |
| "//third_party/googletest:gtest", |
| ] |
| } |
| |
| bt_gtest_package("bt-host-tests") { |
| deps = [ ":component_tests" ] |
| } |
| |
| bt_gtest_package("bt-host-transport-tests") { |
| with_death_tests = true |
| deps = [ "transport:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-gap-tests") { |
| with_death_tests = true |
| deps = [ "gap:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-gatt-tests") { |
| deps = [ "gatt:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-common-tests") { |
| with_death_tests = true |
| deps = [ "common:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-l2cap-tests") { |
| with_death_tests = true |
| deps = [ "l2cap:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-att-tests") { |
| with_death_tests = true |
| deps = [ "att:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-hci-tests") { |
| with_death_tests = true |
| deps = [ "hci:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-hci-spec-tests") { |
| deps = [ "hci-spec:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-sco-tests") { |
| deps = [ "sco:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-sdp-tests") { |
| deps = [ "sdp:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-sm-tests") { |
| with_death_tests = true |
| deps = [ "sm:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-iso-tests") { |
| deps = [ "iso:tests.lib" ] |
| } |
| |
| bt_gtest_package("bt-host-testing-tests") { |
| deps = [ "testing:tests.lib" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":bt-host-att-tests", |
| ":bt-host-common-tests", |
| ":bt-host-gap-tests", |
| ":bt-host-gatt-tests", |
| ":bt-host-hci-spec-tests", |
| ":bt-host-hci-tests", |
| ":bt-host-iso-tests", |
| ":bt-host-l2cap-tests", |
| ":bt-host-sco-tests", |
| ":bt-host-sdp-tests", |
| ":bt-host-sm-tests", |
| ":bt-host-testing-tests", |
| ":bt-host-tests", |
| ":bt-host-transport-tests", |
| ":fuzzers", |
| "controllers:bt-host-controllers-tests", |
| "fidl:bt-host-fidl-tests", |
| "socket:bt-host-socket-tests", |
| ] |
| } |
| |
| group("bazel_tests") { |
| testonly = true |
| deps = [ |
| "att:test_pkg", |
| "common:test_pkg", |
| "gap:test_pkg", |
| "gatt:test_pkg", |
| "hci:test_pkg", |
| "hci-spec:test_pkg", |
| "iso:test_pkg", |
| "l2cap:test_pkg", |
| "sco:test_pkg", |
| "sdp:test_pkg", |
| "sm:test_pkg", |
| "socket:test_pkg", |
| "testing:test_pkg", |
| "transport:test_pkg", |
| ] |
| } |