xref: /aosp_15_r20/external/pigweed/pw_bluetooth_sapphire/host/common/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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("@pigweed//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
16
17package(default_visibility = ["//visibility:public"])
18
19exports_files(glob(["**/*"]))
20
21cc_library(
22    name = "common",
23    srcs = [
24        "advertising_data.cc",
25        "bounded_inspect_list_node.cc",
26        "byte_buffer.cc",
27        "device_address.cc",
28        "device_class.cc",
29        "host_error.cc",
30        "identifier.cc",
31        "log.cc",
32        "manufacturer_names.cc",
33        "metrics.cc",
34        "random.cc",
35        "retire_log.cc",
36        "slab_allocator.cc",
37        "supplement_data.cc",
38        "uuid.cc",
39    ],
40    # This library is not compatible with --config=rp2040.
41    target_compatible_with = select({
42        "@platforms//os:fuchsia": [],
43        "@platforms//os:linux": [],
44        "@platforms//os:macos": [],
45        "//conditions:default": ["@platforms//:incompatible"],
46    }),
47    deps = [
48        "//pw_bluetooth_sapphire:config",
49        "//pw_bluetooth_sapphire:public",
50        "//pw_bluetooth_sapphire/lib/cpp-string",
51        "//pw_bluetooth_sapphire/lib/cpp-type",
52        "@pigweed//pw_assert",
53        "@pigweed//pw_async:dispatcher",
54        "@pigweed//pw_async:task",
55        "@pigweed//pw_bluetooth:emboss_hci",
56        "@pigweed//pw_intrusive_ptr",
57        "@pigweed//pw_log",
58        "@pigweed//pw_random",
59        "@pigweed//pw_span",
60        "@pigweed//pw_string",
61        "@pigweed//pw_string:utf_codecs",
62        "@pigweed//third_party/fuchsia:fit",
63    ] + select({
64        "@platforms//os:fuchsia": [
65            "@fuchsia_sdk//pkg/inspect_component_cpp",
66            "@fuchsia_sdk//pkg/trace",
67        ],
68        "//conditions:default": [],
69    }),
70)
71
72cc_library(
73    name = "uuid_string_util",
74    srcs = ["uuid_string_util.cc"],
75    deps = [":common"],
76)
77
78pw_cc_test(
79    name = "common_test",
80    srcs = [
81        "advertising_data_test.cc",
82        "bounded_inspect_list_node_test.cc",
83        "byte_buffer_test.cc",
84        "device_address_test.cc",
85        "device_class_test.cc",
86        "error_test.cc",
87        "expiring_set_test.cc",
88        "identifier_test.cc",
89        "inspectable_test.cc",
90        "manufacturer_names_test.cc",
91        "metrics_test.cc",
92        "packet_view_test.cc",
93        "pipeline_monitor_test.cc",
94        "retire_log_test.cc",
95        "slab_allocator_test.cc",
96        "supplement_data_test.cc",
97        "uuid_test.cc",
98        "weak_self_test.cc",
99        "windowed_inspect_numeric_property_test.cc",
100    ],
101    test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main",
102    deps = [
103        ":common",
104        ":uuid_string_util",
105        "//pw_bluetooth_sapphire/host/testing",
106        "@pigweed//pw_async:fake_dispatcher_fixture",
107    ],
108)
109