# 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. import("//build_overrides/pigweed.gni") import("$dir_pigweed/third_party/emboss/emboss.gni") import("$dir_pw_bloat/bloat.gni") import("$dir_pw_build/target_types.gni") import("$dir_pw_chrono/backend.gni") import("$dir_pw_docgen/docs.gni") import("$dir_pw_unit_test/test.gni") config("public_include_path") { include_dirs = [ "public" ] visibility = [ ":*" ] } pw_doc_group("docs") { # Also, sources with doxygen comment blocks must be added to //docs/BUILD.gn inputs = [ "proxy_host_test.cc" ] sources = [ "docs.rst" ] report_deps = [ ":use_passthrough_proxy_size_report" ] } pw_test_group("tests") { tests = [ ":pw_bluetooth_proxy_test" ] } pw_source_set("pw_bluetooth_proxy") { public_configs = [ ":public_include_path" ] # LINT.IfChange public = [ "public/pw_bluetooth_proxy/basic_l2cap_channel.h", "public/pw_bluetooth_proxy/gatt_notify_channel.h", "public/pw_bluetooth_proxy/h4_packet.h", "public/pw_bluetooth_proxy/internal/acl_data_channel.h", "public/pw_bluetooth_proxy/internal/gatt_notify_channel_internal.h", "public/pw_bluetooth_proxy/internal/h4_storage.h", "public/pw_bluetooth_proxy/internal/hci_transport.h", "public/pw_bluetooth_proxy/internal/l2cap_aclu_signaling_channel.h", "public/pw_bluetooth_proxy/internal/l2cap_channel.h", "public/pw_bluetooth_proxy/internal/l2cap_channel_manager.h", "public/pw_bluetooth_proxy/internal/l2cap_coc_internal.h", "public/pw_bluetooth_proxy/internal/l2cap_leu_signaling_channel.h", "public/pw_bluetooth_proxy/internal/l2cap_signaling_channel.h", "public/pw_bluetooth_proxy/internal/l2cap_status_tracker.h", "public/pw_bluetooth_proxy/internal/logical_transport.h", "public/pw_bluetooth_proxy/internal/multibuf_writer.h", "public/pw_bluetooth_proxy/internal/rfcomm_fcs.h", "public/pw_bluetooth_proxy/l2cap_channel_common.h", "public/pw_bluetooth_proxy/l2cap_coc.h", "public/pw_bluetooth_proxy/l2cap_status_delegate.h", "public/pw_bluetooth_proxy/proxy_host.h", "public/pw_bluetooth_proxy/rfcomm_channel.h", ] # LINT.ThenChange(BUILD.bazel, CMakeLists.txt) # LINT.IfChange public_deps = [ "$dir_pw_allocator:best_fit", "$dir_pw_allocator:synchronized_allocator", "$dir_pw_bluetooth:emboss_att", "$dir_pw_bluetooth:emboss_hci_commands", "$dir_pw_bluetooth:emboss_hci_common", "$dir_pw_bluetooth:emboss_hci_data", "$dir_pw_bluetooth:emboss_hci_events", "$dir_pw_bluetooth:emboss_hci_h4", "$dir_pw_bluetooth:emboss_l2cap_frames", "$dir_pw_bluetooth:emboss_rfcomm_frames", "$dir_pw_bluetooth:emboss_util", "$dir_pw_multibuf", "$dir_pw_multibuf:simple_allocator", "$dir_pw_span:cast", "$dir_pw_sync:lock_annotations", "$dir_pw_sync:mutex", dir_pw_containers, dir_pw_function, dir_pw_log, dir_pw_result, dir_pw_span, dir_pw_status, ] deps = [ dir_pw_log ] sources = [ "acl_data_channel.cc", "basic_l2cap_channel.cc", "gatt_notify_channel.cc", "h4_storage.cc", "l2cap_aclu_signaling_channel.cc", "l2cap_channel.cc", "l2cap_channel_manager.cc", "l2cap_coc.cc", "l2cap_leu_signaling_channel.cc", "l2cap_signaling_channel.cc", "l2cap_status_tracker.cc", "multibuf_writer.cc", "proxy_host.cc", "rfcomm_channel.cc", "rfcomm_fcs.cc", ] # LINT.ThenChange(Android.bp, BUILD.bazel, CMakeLists.txt) } pw_source_set("test_utils") { # TODO: b/303282642 - Remove this testonly testonly = pw_unit_test_TESTONLY # LINT.IfChange public = [ "pw_bluetooth_proxy_private/test_utils.h" ] public_deps = [ ":pw_bluetooth_proxy", "$dir_pw_bluetooth:emboss_hci_commands", "$dir_pw_bluetooth:emboss_hci_common", "$dir_pw_bluetooth:emboss_hci_events", "$dir_pw_bluetooth:emboss_hci_h4", "$dir_pw_bluetooth:emboss_util", "$dir_pw_multibuf:testing", "$dir_pw_third_party/fuchsia:stdcompat", "$dir_pw_unit_test", ] sources = [ "test_utils.cc" ] # LINT.ThenChange(BUILD.bazel, CMakeLists.txt) visibility = [ ":*" ] } pw_test("pw_bluetooth_proxy_test") { enable_if = dir_pw_third_party_emboss != "" && pw_chrono_SYSTEM_CLOCK_BACKEND != "" include_dirs = [ "." ] # LINT.IfChange deps = [ ":pw_bluetooth_proxy", ":test_utils", "$dir_pw_bluetooth:emboss_att", "$dir_pw_bluetooth:emboss_hci_commands", "$dir_pw_bluetooth:emboss_hci_common", "$dir_pw_bluetooth:emboss_hci_events", "$dir_pw_bluetooth:emboss_hci_h4", "$dir_pw_bluetooth:emboss_util", "$dir_pw_multibuf", "$dir_pw_third_party/fuchsia:stdcompat", ] sources = [ "gatt_notify_test.cc", "h4_packet_test.cc", "l2cap_coc_test.cc", "multibuf_writer_test.cc", "proxy_host_test.cc", "rfcomm_fcs_test.cc", "rfcomm_test.cc", "utils_test.cc", ] # LINT.ThenChange(BUILD.bazel, CMakeLists.txt) } # We depend on emboss, so we can only compute size when emboss is in the build. if (dir_pw_third_party_emboss != "") { pw_size_diff("use_passthrough_proxy_size_report") { title = "pw_bluetooth_proxy Passthrough Size Report" base = "$dir_pw_bloat:bloat_base" binaries = [ { target = "size_report:use_passthrough_proxy" label = "Create and use proxy as a simple passthrough" }, ] } } else { pw_size_diff("use_passthrough_proxy_size_report") { title = "pw_bluetooth_proxy Passthrough Size Report" base = "$dir_pw_bloat:bloat_base" binaries = [ { target = "$dir_pw_bloat:bloat_base" label = "Emboss not configured." }, ] } }