• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15load(
16    "@rules_fuchsia//fuchsia:defs.bzl",
17    "fuchsia_cc_library",
18    "fuchsia_cc_test",
19    "fuchsia_unittest_package",
20)
21load("//pw_bluetooth_sapphire/fuchsia:fuchsia_api_level.bzl", "FUCHSIA_API_LEVEL")
22
23package(default_visibility = ["//visibility:public"])
24
25fuchsia_cc_library(
26    name = "public",
27    hdrs = [
28        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/adapter_test_fixture.h",
29        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/channel_server.h",
30        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/fake_adapter_test_fixture.h",
31        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/fake_gatt_fixture.h",
32        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/fake_hci_transport_server.h",
33        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/fake_vendor_server.h",
34        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt2_client_server.h",
35        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt2_remote_service_server.h",
36        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt2_server_ids.h",
37        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt2_server_server.h",
38        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt_client_server.h",
39        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt_remote_service_server.h",
40        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/gatt_server_server.h",
41        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/helpers.h",
42        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/host_server.h",
43        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/iso_stream_server.h",
44        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/low_energy_central_server.h",
45        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/low_energy_connection_server.h",
46        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/low_energy_peripheral_server.h",
47        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/profile_server.h",
48        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/server_base.h",
49    ],
50    strip_include_prefix = "public",
51    deps = [
52        "//pw_bluetooth_sapphire/fuchsia/host/socket:public",
53    ],
54)
55
56fuchsia_cc_library(
57    name = "fidl",
58    srcs = [
59        "channel_server.cc",
60        "gatt2_client_server.cc",
61        "gatt2_remote_service_server.cc",
62        "gatt2_server_server.cc",
63        "gatt_client_server.cc",
64        "gatt_remote_service_server.cc",
65        "gatt_server_server.cc",
66        "host_server.cc",
67        "iso_stream_server.cc",
68        "low_energy_central_server.cc",
69        "low_energy_connection_server.cc",
70        "low_energy_peripheral_server.cc",
71        "profile_server.cc",
72    ],
73    copts = ["-Wno-format"],
74    deps = [
75        ":helpers",
76        ":public",
77        "//pw_bluetooth_sapphire/fuchsia/host/fidl/measure_tape:peer_hlcpp",
78        "//pw_bluetooth_sapphire/fuchsia/host/fidl/measure_tape:read_by_type_result_hlcpp",
79        "//pw_bluetooth_sapphire/fuchsia/lib/fidl",
80        "//pw_bluetooth_sapphire/host:stack",
81        "@fuchsia_sdk//fidl/fuchsia.bluetooth:fuchsia.bluetooth_hlcpp",
82        "@fuchsia_sdk//fidl/fuchsia.bluetooth.gatt:fuchsia.bluetooth.gatt_hlcpp",
83        "@fuchsia_sdk//fidl/fuchsia.bluetooth.gatt2:fuchsia.bluetooth.gatt2_hlcpp",
84        "@fuchsia_sdk//fidl/fuchsia.bluetooth.host:fuchsia.bluetooth.host_hlcpp",
85        "@fuchsia_sdk//fidl/fuchsia.bluetooth.le:fuchsia.bluetooth.le_hlcpp",
86        "@fuchsia_sdk//pkg/fit-promise",
87        "@fuchsia_sdk//pkg/zx",
88        "@pigweed//pw_intrusive_ptr",
89    ],
90)
91
92fuchsia_cc_library(
93    name = "helpers",
94    srcs = [
95        "helpers.cc",
96    ],
97    copts = ["-Wno-format"],
98    deps = [
99        ":public",
100        "//pw_bluetooth_sapphire/host/common",
101        "//pw_bluetooth_sapphire/host/common:uuid_string_util",
102        "//pw_bluetooth_sapphire/host/gap",
103        "//pw_bluetooth_sapphire/host/gatt",
104        "//pw_bluetooth_sapphire/host/hci",
105        "//pw_bluetooth_sapphire/host/sdp",
106        "@fuchsia_sdk//fidl/fuchsia.bluetooth.bredr:fuchsia.bluetooth.bredr_cpp",
107        "@fuchsia_sdk//fidl/fuchsia.bluetooth:fuchsia.bluetooth_hlcpp",
108        "@fuchsia_sdk//fidl/fuchsia.bluetooth.gatt:fuchsia.bluetooth.gatt_hlcpp",
109        "@fuchsia_sdk//fidl/fuchsia.bluetooth.gatt2:fuchsia.bluetooth.gatt2_hlcpp",
110        "@fuchsia_sdk//fidl/fuchsia.bluetooth.host:fuchsia.bluetooth.host_hlcpp",
111        "@fuchsia_sdk//fidl/fuchsia.hardware.bluetooth:fuchsia.hardware.bluetooth_cpp",
112    ],
113)
114
115fuchsia_cc_library(
116    name = "activity_governor_lease_provider",
117    srcs = [
118        "activity_governor_lease_provider.cc",
119    ],
120    hdrs = [
121        "public/pw_bluetooth_sapphire/fuchsia/host/fidl/activity_governor_lease_provider.h",
122    ],
123    implementation_deps = ["//pw_assert:check"],
124    strip_include_prefix = "public",
125    deps = [
126        "//pw_bluetooth_sapphire:lease",
127        "//pw_bluetooth_sapphire/host/common",
128        "@fuchsia_sdk//fidl/fuchsia.power.system:fuchsia.power.system_cpp",
129    ],
130)
131
132fuchsia_cc_library(
133    name = "adapter_test_fixture",
134    testonly = True,
135    srcs = [
136        "adapter_test_fixture.cc",
137    ],
138    deps = [
139        ":public",
140        "//pw_async_fuchsia:dispatcher",
141        "//pw_bluetooth_sapphire/host/gap",
142        "//pw_bluetooth_sapphire/host/gatt:testing",
143        "//pw_bluetooth_sapphire/host/l2cap:testing",
144        "//pw_bluetooth_sapphire/host/testing",
145        "//pw_bluetooth_sapphire/host/testing:fake_controller",
146        "//pw_bluetooth_sapphire/host/testing:loop_fixture",
147        "@fuchsia_sdk//fidl/fuchsia.io:fuchsia.io_hlcpp",
148    ],
149)
150
151fuchsia_cc_library(
152    name = "fake_adapter_test_fixture",
153    testonly = True,
154    deps = [
155        ":public",
156        "//pw_async_fuchsia:dispatcher",
157        "//pw_bluetooth_sapphire/host/common",
158        "//pw_bluetooth_sapphire/host/gatt",
159        "//pw_bluetooth_sapphire/host/gatt:testing",
160        "//pw_bluetooth_sapphire/host/testing:loop_fixture",
161    ],
162)
163
164fuchsia_cc_library(
165    name = "fake_gatt_test_fixture",
166    testonly = True,
167    srcs = [
168        "fake_gatt_fixture.cc",
169    ],
170    deps = [
171        ":public",
172        "//pw_async_fuchsia:dispatcher",
173        "//pw_bluetooth_sapphire/host/common",
174        "//pw_bluetooth_sapphire/host/gatt",
175        "//pw_bluetooth_sapphire/host/gatt:testing",
176        "//pw_bluetooth_sapphire/host/testing:loop_fixture",
177    ],
178)
179
180fuchsia_cc_library(
181    name = "fake_vendor_server",
182    testonly = True,
183    srcs = [
184        "fake_hci_transport_server.cc",
185    ],
186    deps = [
187        ":public",
188        "//pw_bluetooth_sapphire/host/common",
189        "//pw_bluetooth_sapphire/host/iso",
190        "//pw_bluetooth_sapphire/host/transport",
191        "//pw_unit_test",
192        "@com_google_googletest//:gtest",
193        "@fuchsia_sdk//fidl/fuchsia.hardware.bluetooth:fuchsia.hardware.bluetooth_cpp",
194        "@fuchsia_sdk//pkg/async-cpp",
195        "@fuchsia_sdk//pkg/fidl_cpp",
196        "@fuchsia_sdk//pkg/zx",
197    ],
198)
199
200fuchsia_cc_test(
201    name = "fidl_test",
202    testonly = True,
203    srcs = [
204        "activity_governor_lease_provider_test.cc",
205        "channel_server_test.cc",
206        "gatt2_client_server_test.cc",
207        "gatt2_remote_service_server_test.cc",
208        "gatt2_server_server_test.cc",
209        "gatt_client_server_test.cc",
210        "gatt_remote_service_server_test.cc",
211        "helpers_test.cc",
212        "host_server_test.cc",
213        "iso_stream_server_test.cc",
214        "low_energy_central_server_test.cc",
215        "low_energy_connection_server_test.cc",
216        "low_energy_peripheral_server_test.cc",
217        "profile_server_test.cc",
218    ],
219    death_unittest = True,
220    visibility = ["//visibility:public"],
221    deps = [
222        ":activity_governor_lease_provider",
223        ":adapter_test_fixture",
224        ":fake_adapter_test_fixture",
225        ":fake_gatt_test_fixture",
226        ":fidl",
227        "//pw_bluetooth_sapphire/host/gap:testing",
228        "//pw_bluetooth_sapphire/host/gatt:testing",
229        "//pw_bluetooth_sapphire/host/iso:testing",
230        "//pw_bluetooth_sapphire/host/testing",
231        "//pw_bluetooth_sapphire/host/testing:fake_controller",
232        "//pw_bluetooth_sapphire/host/testing:gtest_helpers",
233        "//pw_bluetooth_sapphire/host/testing:gtest_main",
234        "//pw_bluetooth_sapphire/host/testing:loop_fixture",
235        "//pw_bluetooth_sapphire/host/testing:test_helpers",
236    ],
237)
238
239fuchsia_unittest_package(
240    name = "test_pkg",
241    package_name = "bt_host_fidl_tests_bazel",
242    fuchsia_api_level = FUCHSIA_API_LEVEL,
243    unit_tests = [
244        ":fidl_test",
245    ],
246    visibility = ["//visibility:public"],
247)
248