| # 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/config/fuchsia/rules.gni") | 
 | import("//build/driver_package.gni") | 
 | import("//build/fuzzing/fuzzer.gni") | 
 |  | 
 | driver_module("driver") { | 
 |   output_name = "bt-host" | 
 |  | 
 |   sources = [ "driver.cc" ] | 
 |  | 
 |   deps = [ ":sources" ] | 
 |  | 
 |   configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ] | 
 |   configs += [ "//build/config/fuchsia:static_cpp_standard_library" ] | 
 | } | 
 |  | 
 | source_set("sources") { | 
 |   sources = [ | 
 |     "gatt_host.cc", | 
 |     "gatt_host.h", | 
 |     "gatt_remote_service_device.cc", | 
 |     "gatt_remote_service_device.h", | 
 |     "host.cc", | 
 |     "host.h", | 
 |     "host_device.cc", | 
 |     "host_device.h", | 
 |  | 
 |     # FIDL servers | 
 |     "fidl/gatt_client_server.cc", | 
 |     "fidl/gatt_client_server.h", | 
 |     "fidl/gatt_remote_service_server.cc", | 
 |     "fidl/gatt_remote_service_server.h", | 
 |     "fidl/gatt_server_server.cc", | 
 |     "fidl/gatt_server_server.h", | 
 |     "fidl/helpers.cc", | 
 |     "fidl/helpers.h", | 
 |     "fidl/host_server.cc", | 
 |     "fidl/host_server.h", | 
 |     "fidl/low_energy_central_server.cc", | 
 |     "fidl/low_energy_central_server.h", | 
 |     "fidl/low_energy_connection_server.cc", | 
 |     "fidl/low_energy_connection_server.h", | 
 |     "fidl/low_energy_peripheral_server.cc", | 
 |     "fidl/low_energy_peripheral_server.h", | 
 |     "fidl/profile_server.cc", | 
 |     "fidl/profile_server.h", | 
 |     "fidl/server_base.h", | 
 |   ] | 
 |  | 
 |   deps = [ "//src/devices/lib/driver" ] | 
 |  | 
 |   public_deps = [ | 
 |     ":stack", | 
 |     "//sdk/banjo/ddk.protocol.bt.gattsvc", | 
 |     "//sdk/fidl/fuchsia.bluetooth", | 
 |     "//sdk/fidl/fuchsia.bluetooth.control", | 
 |     "//sdk/fidl/fuchsia.bluetooth.gatt", | 
 |     "//sdk/fidl/fuchsia.bluetooth.le", | 
 |     "//sdk/fidl/fuchsia.hardware.bluetooth:fuchsia.hardware.bluetooth_c", | 
 |     "//src/connectivity/bluetooth/fidl:host", | 
 |     "//src/connectivity/bluetooth/lib/fidl", | 
 |     "//src/lib/ddk", | 
 |     "//src/lib/fxl", | 
 |     "//zircon/public/lib/fbl", | 
 |     "//zircon/public/lib/fit", | 
 |     "//zircon/public/lib/zx", | 
 |     "//zircon/system/ulib/trace:trace-driver", | 
 |   ] | 
 | } | 
 |  | 
 | group("stack") { | 
 |   public_deps = [ | 
 |     "att", | 
 |     "cobalt:base", | 
 |     "cobalt:real", | 
 |     "common", | 
 |     "data", | 
 |     "gap", | 
 |     "gatt", | 
 |     "hci", | 
 |     "l2cap", | 
 |     "sdp", | 
 |     "sm", | 
 |   ] | 
 | } | 
 |  | 
 | # TODO(armansito): Enable debug assertions by default from here for all package | 
 | # dependencies when there is a way for it. | 
 | driver_package("bt-host") { | 
 |   deps = [ ":driver" ] | 
 |  | 
 |   drivers = [ | 
 |     { | 
 |       name = "bt-host.so" | 
 |     }, | 
 |   ] | 
 | } | 
 |  | 
 | # Unit tests for driver code, not including the Bluetooth stack unit tests | 
 | # defined in subdirectories. | 
 | source_set("driver_tests") { | 
 |   testonly = true | 
 |  | 
 |   sources = [ | 
 |     "fidl/adapter_test_fixture.cc", | 
 |     "fidl/adapter_test_fixture.h", | 
 |     "fidl/gatt_remote_service_server_unittest.cc", | 
 |     "fidl/helpers_unittest.cc", | 
 |     "fidl/host_server_unittest.cc", | 
 |     "fidl/low_energy_central_server_unittest.cc", | 
 |     "fidl/low_energy_peripheral_server_unittest.cc", | 
 |     "fidl/profile_server_unittest.cc", | 
 |     "gatt_host_unittest.cc", | 
 |   ] | 
 |  | 
 |   deps = [ | 
 |     ":sources", | 
 |     "data:testing", | 
 |     "gap:testing", | 
 |     "gatt:testing", | 
 |     "testing:fake_controller", | 
 |     "testing:testing", | 
 |     "//third_party/googletest:gmock", | 
 |     "//third_party/googletest:gtest", | 
 |   ] | 
 | } | 
 |  | 
 | executable("tests") { | 
 |   testonly = true | 
 |  | 
 |   output_name = "bt-host-unittests" | 
 |  | 
 |   deps = [ | 
 |     ":driver_tests", | 
 |     "att:tests", | 
 |     "cobalt:tests", | 
 |     "common:tests", | 
 |     "data:tests", | 
 |     "gap:tests", | 
 |     "gatt:tests", | 
 |     "hci:tests", | 
 |     "l2cap:tests", | 
 |     "sdp:tests", | 
 |     "sm:tests", | 
 |     "testing:gtest_main", | 
 |     "//src/devices/lib/driver", | 
 |     "//third_party/googletest:gtest", | 
 |   ] | 
 |  | 
 |   # TODO(46537): Fix the leaks and remove this. | 
 |   deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] | 
 | } | 
 |  | 
 | fuzzers_package("fuzzers") { | 
 |   package_name = "bt-host-fuzzers" | 
 |   fuzzers = [ | 
 |     "data:data_fuzzer", | 
 |     "l2cap:basic_mode_rx_engine_fuzzer", | 
 |     "l2cap:enhanced_retransmission_mode_engines_fuzzer", | 
 |     "l2cap:bredr_dynamic_channel_registry_fuzzer", | 
 |   ] | 
 | } |