• 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("@rules_cc//cc:cc_library.bzl", "cc_library")
16load("//pw_fuzzer:fuzzer.bzl", "pw_cc_fuzz_test")
17load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
18
19package(
20    default_visibility = ["//visibility:public"],
21    features = ["-layering_check"],
22)
23
24cc_library(
25    name = "common",
26    srcs = [
27        "advertising_data.cc",
28        "bounded_inspect_list_node.cc",
29        "byte_buffer.cc",
30        "device_address.cc",
31        "device_class.cc",
32        "host_error.cc",
33        "identifier.cc",
34        "log.cc",
35        "manufacturer_names.cc",
36        "metrics.cc",
37        "random.cc",
38        "retire_log.cc",
39        "slab_allocator.cc",
40        "supplement_data.cc",
41        "uuid.cc",
42    ],
43    hdrs = [
44        "public/pw_bluetooth_sapphire/internal/host/common/advertising_data.h",
45        "public/pw_bluetooth_sapphire/internal/host/common/bounded_inspect_list_node.h",
46        "public/pw_bluetooth_sapphire/internal/host/common/byte_buffer.h",
47        "public/pw_bluetooth_sapphire/internal/host/common/device_address.h",
48        "public/pw_bluetooth_sapphire/internal/host/common/device_class.h",
49        "public/pw_bluetooth_sapphire/internal/host/common/error.h",
50        "public/pw_bluetooth_sapphire/internal/host/common/expiring_set.h",
51        "public/pw_bluetooth_sapphire/internal/host/common/fake_inspect.h",
52        "public/pw_bluetooth_sapphire/internal/host/common/host_error.h",
53        "public/pw_bluetooth_sapphire/internal/host/common/identifier.h",
54        "public/pw_bluetooth_sapphire/internal/host/common/inspect.h",
55        "public/pw_bluetooth_sapphire/internal/host/common/inspectable.h",
56        "public/pw_bluetooth_sapphire/internal/host/common/log.h",
57        "public/pw_bluetooth_sapphire/internal/host/common/macros.h",
58        "public/pw_bluetooth_sapphire/internal/host/common/manufacturer_names.h",
59        "public/pw_bluetooth_sapphire/internal/host/common/metrics.h",
60        "public/pw_bluetooth_sapphire/internal/host/common/packet_view.h",
61        "public/pw_bluetooth_sapphire/internal/host/common/pipeline_monitor.h",
62        "public/pw_bluetooth_sapphire/internal/host/common/random.h",
63        "public/pw_bluetooth_sapphire/internal/host/common/retire_log.h",
64        "public/pw_bluetooth_sapphire/internal/host/common/slab_allocator.h",
65        "public/pw_bluetooth_sapphire/internal/host/common/slab_buffer.h",
66        "public/pw_bluetooth_sapphire/internal/host/common/smart_task.h",
67        "public/pw_bluetooth_sapphire/internal/host/common/supplement_data.h",
68        "public/pw_bluetooth_sapphire/internal/host/common/to_string.h",
69        "public/pw_bluetooth_sapphire/internal/host/common/trace.h",
70        "public/pw_bluetooth_sapphire/internal/host/common/uint128.h",
71        "public/pw_bluetooth_sapphire/internal/host/common/uint256.h",
72        "public/pw_bluetooth_sapphire/internal/host/common/uuid.h",
73        "public/pw_bluetooth_sapphire/internal/host/common/weak_self.h",
74        "public/pw_bluetooth_sapphire/internal/host/common/windowed_inspect_numeric_property.h",
75    ],
76    implementation_deps = [
77        "//pw_string",
78        "//pw_string:utf_codecs",
79    ],
80    strip_include_prefix = "public",
81    tags = ["noclangtidy"],
82    # This library is not compatible with --config=rp2040.
83    target_compatible_with = select({
84        "@platforms//os:fuchsia": [],
85        "@platforms//os:linux": [],
86        "@platforms//os:macos": [],
87        "//conditions:default": ["@platforms//:incompatible"],
88    }),
89    deps = [
90        "//pw_async:dispatcher",
91        "//pw_async:task",
92        "//pw_bluetooth:emboss_hci",
93        "//pw_bluetooth_sapphire:config",
94        "//pw_bluetooth_sapphire/lib/cpp-string",
95        "//pw_bluetooth_sapphire/lib/cpp-type",
96        "//pw_chrono:system_clock",
97        "//pw_intrusive_ptr",
98        "//pw_log",
99        "//pw_preprocessor",
100        "//pw_random",
101        "//pw_span",
102        "//third_party/fuchsia:fit",
103    ] + select({
104        "@platforms//os:fuchsia": [
105            "@fuchsia_sdk//pkg/inspect_component_cpp",
106            "@fuchsia_sdk//pkg/trace",
107        ],
108        "//conditions:default": [],
109    }),
110)
111
112cc_library(
113    name = "uuid_string_util",
114    srcs = ["uuid_string_util.cc"],
115    implementation_deps = [":common"],
116)
117
118pw_cc_test(
119    name = "common_test",
120    srcs = [
121        "advertising_data_test.cc",
122        "bounded_inspect_list_node_test.cc",
123        "byte_buffer_test.cc",
124        "device_address_test.cc",
125        "device_class_test.cc",
126        "error_test.cc",
127        "expiring_set_test.cc",
128        "identifier_test.cc",
129        "inspectable_test.cc",
130        "manufacturer_names_test.cc",
131        "metrics_test.cc",
132        "packet_view_test.cc",
133        "pipeline_monitor_test.cc",
134        "retire_log_test.cc",
135        "slab_allocator_test.cc",
136        "supplement_data_test.cc",
137        "uuid_test.cc",
138        "weak_self_test.cc",
139        "windowed_inspect_numeric_property_test.cc",
140    ],
141    # TODO: https://pwbug.dev/393957973 - Fix this test.
142    tags = ["noubsan"],
143    test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main",
144    deps = [
145        ":common",
146        ":uuid_string_util",
147        "//pw_async:fake_dispatcher_fixture",
148        "//pw_bluetooth_sapphire/host/testing",
149        "//pw_bluetooth_sapphire/host/testing:gtest_helpers",
150        "//pw_bluetooth_sapphire/host/testing:test_helpers",
151    ],
152)
153
154pw_cc_fuzz_test(
155    name = "advertising_data_fuzzer",
156    srcs = ["advertising_data_fuzztest.cc"],
157    deps = [":common"],
158)
159