• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 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("@rules_cc//cc:cc_library.bzl", "cc_library")
16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
17load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
19
20package(
21    default_visibility = ["//pw_bluetooth_sapphire:__subpackages__"],
22    features = ["-layering_check"],
23)
24
25cc_library(
26    name = "config",
27    srcs = [],
28    hdrs = [
29        "public/pw_bluetooth_sapphire/config.h",
30    ],
31    defines = select({
32        "@platforms//os:fuchsia": [
33            "PW_BLUETOOTH_SAPPHIRE_INSPECT_ENABLED",
34            "PW_BLUETOOTH_SAPPHIRE_TRACE_ENABLED",
35        ],
36        "//conditions:default": [],
37    }),
38    strip_include_prefix = "public",
39)
40
41cc_library(
42    name = "central",
43    srcs = ["central.cc"],
44    hdrs = ["public/pw_bluetooth_sapphire/central.h"],
45    strip_include_prefix = "public",
46    tags = ["noclangtidy"],
47    deps = [
48        ":connection",
49        ":uuid",
50        "//pw_bluetooth:pw_bluetooth2",
51        "//pw_bluetooth_sapphire/host/gap",
52        "//pw_multibuf:allocator",
53    ],
54)
55
56cc_library(
57    name = "connection",
58    srcs = [
59        "connection.cc",
60        "connection_options.cc",
61    ],
62    hdrs = [
63        "public/pw_bluetooth_sapphire/internal/connection.h",
64        "public/pw_bluetooth_sapphire/internal/connection_options.h",
65    ],
66    strip_include_prefix = "public",
67    tags = ["noclangtidy"],
68    visibility = ["//visibility:private"],
69    deps = [
70        ":uuid",
71        "//pw_bluetooth:pw_bluetooth2",
72        "//pw_bluetooth_sapphire/host/gap",
73    ],
74)
75
76cc_library(
77    name = "uuid",
78    hdrs = [
79        "public/pw_bluetooth_sapphire/internal/uuid.h",
80    ],
81    strip_include_prefix = "public",
82    visibility = ["//visibility:private"],
83    deps = [
84        "//pw_bluetooth:pw_bluetooth2",
85        "//pw_bluetooth_sapphire/host/common",
86        "//pw_span",
87    ],
88)
89
90cc_library(
91    name = "lease",
92    hdrs = [
93        "public/pw_bluetooth_sapphire/lease.h",
94    ],
95    strip_include_prefix = "public",
96    deps = [
97        ":config",
98        "//pw_function",
99        "//pw_result",
100    ],
101)
102
103cc_library(
104    name = "null_lease_provider",
105    hdrs = [
106        "public/pw_bluetooth_sapphire/null_lease_provider.h",
107    ],
108    strip_include_prefix = "public",
109    deps = [
110        ":lease",
111    ],
112)
113
114cc_library(
115    name = "fake_lease_provider",
116    hdrs = [
117        "public/pw_bluetooth_sapphire/fake_lease_provider.h",
118    ],
119    strip_include_prefix = "public",
120    deps = [
121        ":lease",
122    ],
123)
124
125cc_library(
126    name = "power_delegate",
127    hdrs = ["public/pw_bluetooth_sapphire/power_delegate.h"],
128    strip_include_prefix = "public",
129    deps = [":lease"],
130)
131
132pw_cc_test(
133    name = "lease_test",
134    srcs = ["lease_test.cc"],
135    deps = [
136        ":lease",
137    ],
138)
139
140pw_cc_test(
141    name = "null_lease_provider_test",
142    srcs = [
143        "null_lease_provider_test.cc",
144    ],
145    deps = [
146        ":null_lease_provider",
147    ],
148)
149
150pw_cc_test(
151    name = "fake_lease_provider_test",
152    srcs = [
153        "fake_lease_provider_test.cc",
154    ],
155    deps = [
156        ":fake_lease_provider",
157    ],
158)
159
160pw_cc_test(
161    name = "central_test",
162    srcs = ["central_test.cc"],
163    # TODO: https://pwbug.dev/393957973 - Fix this test.
164    tags = ["noubsan"],
165    test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main",
166    deps = [
167        ":central",
168        "//pw_async:fake_dispatcher",
169        "//pw_async2:pend_func_task",
170        "//pw_bluetooth_sapphire/host/gap:testing",
171        "//pw_multibuf:testing",
172    ],
173)
174
175cc_library(
176    name = "peripheral",
177    srcs = ["peripheral.cc"],
178    hdrs = ["public/pw_bluetooth_sapphire/peripheral.h"],
179    includes = ["public"],
180    tags = ["noclangtidy"],
181    deps = [
182        "//pw_bluetooth:pw_bluetooth2",
183        "//pw_bluetooth_sapphire/host/gap",
184        "//pw_sync:mutex",
185    ],
186)
187
188pw_cc_test(
189    name = "peripheral_test",
190    srcs = ["peripheral_test.cc"],
191    # TODO: https://pwbug.dev/393957973 - Fix this test.
192    tags = ["noubsan"],
193    test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main",
194    deps = [
195        ":peripheral",
196        "//pw_async:fake_dispatcher",
197        "//pw_async2:pend_func_task",
198        "//pw_bluetooth_sapphire/host/gap:testing",
199    ],
200)
201
202filegroup(
203    name = "doxygen",
204    srcs = [
205        "public/pw_bluetooth_sapphire/central.h",
206        "public/pw_bluetooth_sapphire/fake_lease_provider.h",
207        "public/pw_bluetooth_sapphire/lease.h",
208        "public/pw_bluetooth_sapphire/null_lease_provider.h",
209        "public/pw_bluetooth_sapphire/peripheral.h",
210        "public/pw_bluetooth_sapphire/power_delegate.h",
211    ],
212    visibility = ["//visibility:public"],
213)
214
215sphinx_docs_library(
216    name = "docs",
217    srcs = [
218        "docs.rst",
219        "fuchsia.rst",
220        "reference.rst",
221        "size_report.rst",
222        "//pw_bluetooth_sapphire/host/att:docs",
223        "//pw_bluetooth_sapphire/host/gap:docs",
224        "//pw_bluetooth_sapphire/host/l2cap:docs",
225    ],
226    prefix = "pw_bluetooth_sapphire/",
227    target_compatible_with = incompatible_with_mcu(),
228    visibility = ["//visibility:public"],
229)
230