# Copyright 2024 The Pigweed Authors # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compliance with the License. You may obtain a copy of # the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations under # the License. load("@rules_cc//cc:cc_library.bzl", "cc_library") load("//pw_fuzzer:fuzzer.bzl", "pw_cc_fuzz_test") load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") package( default_visibility = ["//visibility:public"], features = ["-layering_check"], ) cc_library( name = "common", srcs = [ "advertising_data.cc", "bounded_inspect_list_node.cc", "byte_buffer.cc", "device_address.cc", "device_class.cc", "host_error.cc", "identifier.cc", "log.cc", "manufacturer_names.cc", "metrics.cc", "random.cc", "retire_log.cc", "slab_allocator.cc", "supplement_data.cc", "uuid.cc", ], hdrs = [ "public/pw_bluetooth_sapphire/internal/host/common/advertising_data.h", "public/pw_bluetooth_sapphire/internal/host/common/bounded_inspect_list_node.h", "public/pw_bluetooth_sapphire/internal/host/common/byte_buffer.h", "public/pw_bluetooth_sapphire/internal/host/common/device_address.h", "public/pw_bluetooth_sapphire/internal/host/common/device_class.h", "public/pw_bluetooth_sapphire/internal/host/common/error.h", "public/pw_bluetooth_sapphire/internal/host/common/expiring_set.h", "public/pw_bluetooth_sapphire/internal/host/common/fake_inspect.h", "public/pw_bluetooth_sapphire/internal/host/common/host_error.h", "public/pw_bluetooth_sapphire/internal/host/common/identifier.h", "public/pw_bluetooth_sapphire/internal/host/common/inspect.h", "public/pw_bluetooth_sapphire/internal/host/common/inspectable.h", "public/pw_bluetooth_sapphire/internal/host/common/log.h", "public/pw_bluetooth_sapphire/internal/host/common/macros.h", "public/pw_bluetooth_sapphire/internal/host/common/manufacturer_names.h", "public/pw_bluetooth_sapphire/internal/host/common/metrics.h", "public/pw_bluetooth_sapphire/internal/host/common/packet_view.h", "public/pw_bluetooth_sapphire/internal/host/common/pipeline_monitor.h", "public/pw_bluetooth_sapphire/internal/host/common/random.h", "public/pw_bluetooth_sapphire/internal/host/common/retire_log.h", "public/pw_bluetooth_sapphire/internal/host/common/slab_allocator.h", "public/pw_bluetooth_sapphire/internal/host/common/slab_buffer.h", "public/pw_bluetooth_sapphire/internal/host/common/smart_task.h", "public/pw_bluetooth_sapphire/internal/host/common/supplement_data.h", "public/pw_bluetooth_sapphire/internal/host/common/to_string.h", "public/pw_bluetooth_sapphire/internal/host/common/trace.h", "public/pw_bluetooth_sapphire/internal/host/common/uint128.h", "public/pw_bluetooth_sapphire/internal/host/common/uint256.h", "public/pw_bluetooth_sapphire/internal/host/common/uuid.h", "public/pw_bluetooth_sapphire/internal/host/common/weak_self.h", "public/pw_bluetooth_sapphire/internal/host/common/windowed_inspect_numeric_property.h", ], implementation_deps = [ "//pw_string", "//pw_string:utf_codecs", ], strip_include_prefix = "public", tags = ["noclangtidy"], # This library is not compatible with --config=rp2040. target_compatible_with = select({ "@platforms//os:fuchsia": [], "@platforms//os:linux": [], "@platforms//os:macos": [], "//conditions:default": ["@platforms//:incompatible"], }), deps = [ "//pw_async:dispatcher", "//pw_async:task", "//pw_bluetooth:emboss_hci", "//pw_bluetooth_sapphire:config", "//pw_bluetooth_sapphire/lib/cpp-string", "//pw_bluetooth_sapphire/lib/cpp-type", "//pw_chrono:system_clock", "//pw_intrusive_ptr", "//pw_log", "//pw_preprocessor", "//pw_random", "//pw_span", "//third_party/fuchsia:fit", ] + select({ "@platforms//os:fuchsia": [ "@fuchsia_sdk//pkg/inspect_component_cpp", "@fuchsia_sdk//pkg/trace", ], "//conditions:default": [], }), ) cc_library( name = "uuid_string_util", srcs = ["uuid_string_util.cc"], implementation_deps = [":common"], ) pw_cc_test( name = "common_test", srcs = [ "advertising_data_test.cc", "bounded_inspect_list_node_test.cc", "byte_buffer_test.cc", "device_address_test.cc", "device_class_test.cc", "error_test.cc", "expiring_set_test.cc", "identifier_test.cc", "inspectable_test.cc", "manufacturer_names_test.cc", "metrics_test.cc", "packet_view_test.cc", "pipeline_monitor_test.cc", "retire_log_test.cc", "slab_allocator_test.cc", "supplement_data_test.cc", "uuid_test.cc", "weak_self_test.cc", "windowed_inspect_numeric_property_test.cc", ], # TODO: https://pwbug.dev/393957973 - Fix this test. tags = ["noubsan"], test_main = "//pw_bluetooth_sapphire/host/testing:gtest_main", deps = [ ":common", ":uuid_string_util", "//pw_async:fake_dispatcher_fixture", "//pw_bluetooth_sapphire/host/testing", "//pw_bluetooth_sapphire/host/testing:gtest_helpers", "//pw_bluetooth_sapphire/host/testing:test_helpers", ], ) pw_cc_fuzz_test( name = "advertising_data_fuzzer", srcs = ["advertising_data_fuzztest.cc"], deps = [":common"], )