From c82a1f3f74f1ae2cd7928b56c83dc7df984998fe Mon Sep 17 00:00:00 2001 From: Darren Chan Date: Fri, 23 Aug 2024 19:11:07 +0000 Subject: [PATCH] fuchsia_sdk: Exclude targets from non-linux builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move all references to @fuchsia_sdk into //pw_bluetooth_sapphire/fuchsia and specify --deleted-packages=//pw_bluetooth_sapphire/fuchsia for macos and windows host build configurations. Bug: 357895400 Change-Id: Ib4eb9ea5556cc673ba1b40d2234324def23cdb35 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/230391 Reviewed-by: Armando Montanez Lint: Lint 🤖 Reviewed-by: Ben Lawson Commit-Queue: Darren Chan --- .bazelrc | 15 ++++++ WORKSPACE | 25 ++------- pw_bluetooth_sapphire/BUILD.bazel | 1 + pw_bluetooth_sapphire/docs.rst | 5 ++ pw_bluetooth_sapphire/fuchsia/BUILD.bazel | 21 ++++++-- .../fuchsia/host/att/BUILD.bazel | 44 ++++++++++++++++ .../fuchsia/host/common/BUILD.bazel | 46 +++++++++++++++++ .../fuchsia/host/gap/BUILD.bazel | 51 +++++++++++++++++++ .../fuchsia/host/gatt/BUILD.bazel | 42 +++++++++++++++ .../fuchsia/host/hci-spec/BUILD.bazel | 43 ++++++++++++++++ .../fuchsia/host/hci/BUILD.bazel | 46 +++++++++++++++++ .../fuchsia/host/iso/BUILD.bazel | 44 ++++++++++++++++ .../fuchsia/host/l2cap/BUILD.bazel | 50 ++++++++++++++++++ .../fuchsia/host/sco/BUILD.bazel | 45 ++++++++++++++++ .../fuchsia/host/sdp/BUILD.bazel | 46 +++++++++++++++++ .../fuchsia/host/sm/BUILD.bazel | 47 +++++++++++++++++ .../fuchsia/host/testing/BUILD.bazel | 44 ++++++++++++++++ .../fuchsia/host/transport/BUILD.bazel | 44 ++++++++++++++++ pw_bluetooth_sapphire/fuchsia/host_x64.bzl | 19 ------- pw_bluetooth_sapphire/host/att/BUILD.bazel | 31 ++--------- pw_bluetooth_sapphire/host/common/BUILD.bazel | 31 +++++------ pw_bluetooth_sapphire/host/gap/BUILD.bazel | 31 ++--------- pw_bluetooth_sapphire/host/gatt/BUILD.bazel | 31 ++--------- .../host/hci-spec/BUILD.bazel | 31 ++--------- pw_bluetooth_sapphire/host/hci/BUILD.bazel | 28 ++-------- pw_bluetooth_sapphire/host/iso/BUILD.bazel | 28 ++-------- pw_bluetooth_sapphire/host/l2cap/BUILD.bazel | 34 ++++--------- pw_bluetooth_sapphire/host/sco/BUILD.bazel | 27 ++-------- pw_bluetooth_sapphire/host/sdp/BUILD.bazel | 31 ++--------- pw_bluetooth_sapphire/host/sm/BUILD.bazel | 31 ++--------- .../host/testing/BUILD.bazel | 25 ++------- .../host/transport/BUILD.bazel | 31 ++--------- .../bazel/host_metadata_repository.bzl | 27 ---------- 33 files changed, 712 insertions(+), 383 deletions(-) create mode 100644 pw_bluetooth_sapphire/fuchsia/host/att/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/common/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/gap/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/gatt/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/hci-spec/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/hci/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/iso/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/l2cap/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/sco/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/sdp/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/sm/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/testing/BUILD.bazel create mode 100644 pw_bluetooth_sapphire/fuchsia/host/transport/BUILD.bazel delete mode 100644 pw_bluetooth_sapphire/fuchsia/host_x64.bzl delete mode 100644 pw_env_setup/bazel/host_metadata_repository.bzl diff --git a/.bazelrc b/.bazelrc index 2fc272ea6e..fd435e5417 100644 --- a/.bazelrc +++ b/.bazelrc @@ -269,6 +269,21 @@ common:remote_cache --remote_upload_local_results=false # of --test_strategy value). test --test_output=errors +# Exclude //pw_bluetooth_sapphire/fuchsia when the host platform is not +# linux-amd64. This is the only platform that the Fuchsia SDK supports. +common --enable_platform_specific_config +# Incompatible host platforms. +common:macos --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +common:windows --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +# Target build configurations for which @fuchsia_sdk is irrelevant and thus +# targets should be pruned to avoid fetching @fuchsia_sdk. +common:rp2350 --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +common:rp2040 --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +common:stm32f429i_baremetal --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +common:stm32f429i_freertos --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +common:lm3s6965evb --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... +common:microbit --deleted_packages=//pw_bluetooth_sapphire/fuchsia/... + # User bazelrc file; see # https://bazel.build/configure/best-practices#bazelrc-file # diff --git a/WORKSPACE b/WORKSPACE index dd544cca34..fd26cebc5f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -59,19 +59,12 @@ load("@fuchsia_infra//:workspace.bzl", "fuchsia_infra_workspace") fuchsia_infra_workspace() -FUCHSIA_LINUX_SDK_VERSION = "version:22.20240717.3.1" - -# The Fuchsia SDK is no longer released for MacOS, so we need to pin an older -# version, from the halcyon days when this OS was still supported. -FUCHSIA_MAC_SDK_VERSION = "version:20.20240408.3.1" +FUCHSIA_SDK_VERSION = "version:22.20240717.3.1" cipd_repository( name = "fuchsia_sdk", - path = "fuchsia/sdk/core/fuchsia-bazel-rules/${os}-amd64", - tag_by_os = { - "linux": FUCHSIA_LINUX_SDK_VERSION, - "mac": FUCHSIA_MAC_SDK_VERSION, - }, + path = "fuchsia/sdk/core/fuchsia-bazel-rules/linux-amd64", + tag = FUCHSIA_SDK_VERSION, ) load("@fuchsia_sdk//fuchsia:deps.bzl", "rules_fuchsia_deps") @@ -83,10 +76,7 @@ register_toolchains("@fuchsia_sdk//:fuchsia_toolchain_sdk") cipd_repository( name = "fuchsia_products_metadata", path = "fuchsia/development/product_bundles/v2", - tag_by_os = { - "linux": FUCHSIA_LINUX_SDK_VERSION, - "mac": FUCHSIA_MAC_SDK_VERSION, - }, + tag = FUCHSIA_SDK_VERSION, ) load("@fuchsia_sdk//fuchsia:products.bzl", "fuchsia_products_repository") @@ -111,13 +101,6 @@ load("@fuchsia_clang//:defs.bzl", "register_clang_toolchains") register_clang_toolchains() -# Since Fuchsia doesn't release arm64 SDKs, use this to gate Fuchsia targets. -load("//pw_env_setup:bazel/host_metadata_repository.bzl", "host_metadata_repository") - -host_metadata_repository( - name = "host_metadata", -) - # TODO: b/354268150 - googletest is in the BCR, but its MODULE.bazel doesn't # express its dependency on the Fuchsia SDK correctly. git_repository( diff --git a/pw_bluetooth_sapphire/BUILD.bazel b/pw_bluetooth_sapphire/BUILD.bazel index a9c9d2ed26..b22a190ba7 100644 --- a/pw_bluetooth_sapphire/BUILD.bazel +++ b/pw_bluetooth_sapphire/BUILD.bazel @@ -266,4 +266,5 @@ cc_library( includes = [ "public", ], + tags = ["manual"], ) diff --git a/pw_bluetooth_sapphire/docs.rst b/pw_bluetooth_sapphire/docs.rst index 0ed3c756d6..50f9f2441c 100644 --- a/pw_bluetooth_sapphire/docs.rst +++ b/pw_bluetooth_sapphire/docs.rst @@ -36,6 +36,11 @@ Fuchsia support demonstrate building, running, and testing Fuchsia components and packages with the Fuchsia SDK. +.. note:: + Please do not add any fuchsia-specific dependencies (targets that load from + ``@fuchsia_sdk``) outside of ``//pw_bluetooth_sapphire/fuchsia`` since that + will break the global pigweed build (``//...``) for macos hosts. + It will eventually be filled with the real `bt-host component`_ once that's migrated. See https://fxbug.dev/321267390. diff --git a/pw_bluetooth_sapphire/fuchsia/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/BUILD.bazel index d347322ff5..243d52df85 100644 --- a/pw_bluetooth_sapphire/fuchsia/BUILD.bazel +++ b/pw_bluetooth_sapphire/fuchsia/BUILD.bazel @@ -19,12 +19,11 @@ load( "fuchsia_test_group", ) load("@rules_license//rules:license.bzl", "license") -load("//pw_bluetooth_sapphire/fuchsia:host_x64.bzl", "MANUAL_IF_NOT_LINUX_X64") license( name = "license_fuchsia", package_name = "pw_bluetooth_sapphire (Fuchsia)", - license_text = "//:LICENSE", + license_text = "@pigweed//:LICENSE", ) qemu_tests = [ @@ -44,6 +43,22 @@ fuchsia_test_group( fuchsia_builder_group( name = "infra", build_only = [ + # TODO: https://pwbug.dev/360411906 - Reenable once we can specify the + # correct build configuration for these tests. + # Then, move to `qemu_tests`. + # "//pw_bluetooth_sapphire/fuchsia/host/att:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/common:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/gap:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/gatt:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/hci:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/hci-spec:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/iso:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/l2cap:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/sco:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/sdp:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/sm:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/testing:test_pkg", + # "//pw_bluetooth_sapphire/fuchsia/host/transport:test_pkg", ], test_groups = [ ":tests_qemu", @@ -52,5 +67,5 @@ fuchsia_builder_group( "//pw_bluetooth_sapphire/fuchsia/bt_host:bt_host_x64_cipd", "//pw_bluetooth_sapphire/fuchsia/bt_host:bt_host_arm64_cipd", ], - tags = MANUAL_IF_NOT_LINUX_X64, + tags = ["integration"], ) diff --git a/pw_bluetooth_sapphire/fuchsia/host/att/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/att/BUILD.bazel new file mode 100644 index 0000000000..92dfe74992 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/att/BUILD.bazel @@ -0,0 +1,44 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "att_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/att", + "//pw_bluetooth_sapphire/host/att:att_test.lib", + "//pw_bluetooth_sapphire/host/l2cap:testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "att_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":att_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/common/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/common/BUILD.bazel new file mode 100644 index 0000000000..f1acb5c63d --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/common/BUILD.bazel @@ -0,0 +1,46 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "common_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_async:fake_dispatcher_fixture", + "//pw_bluetooth_sapphire/host/common", + "//pw_bluetooth_sapphire/host/common:common_test.lib", + "//pw_bluetooth_sapphire/host/common:uuid_string_util", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "common_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":common_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/gap/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/gap/BUILD.bazel new file mode 100644 index 0000000000..99c3d99c12 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/gap/BUILD.bazel @@ -0,0 +1,51 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "gap_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/common", + "//pw_bluetooth_sapphire/host/gap", + "//pw_bluetooth_sapphire/host/gap:gap_test.lib", + "//pw_bluetooth_sapphire/host/gap:testing", + "//pw_bluetooth_sapphire/host/gatt:testing", + "//pw_bluetooth_sapphire/host/hci:testing", + "//pw_bluetooth_sapphire/host/l2cap:testing", + "//pw_bluetooth_sapphire/host/sm", + "//pw_bluetooth_sapphire/host/sm:testing", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "gap_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":gap_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/gatt/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/gatt/BUILD.bazel new file mode 100644 index 0000000000..0914f9acb7 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/gatt/BUILD.bazel @@ -0,0 +1,42 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "gatt_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/gatt:gatt_test.lib", + "@pigweed//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "gatt_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":gatt_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/hci-spec/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/hci-spec/BUILD.bazel new file mode 100644 index 0000000000..cf136a50db --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/hci-spec/BUILD.bazel @@ -0,0 +1,43 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "hci_spec_test", + size = "small", + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/hci-spec", + "//pw_bluetooth_sapphire/host/hci-spec:hci-spec_test.lib", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "hci_spec_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":hci_spec_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/hci/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/hci/BUILD.bazel new file mode 100644 index 0000000000..a1cc98125e --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/hci/BUILD.bazel @@ -0,0 +1,46 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "hci_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth:emboss_hci_test", + "//pw_bluetooth_sapphire/host/hci", + "//pw_bluetooth_sapphire/host/hci:hci_test.lib", + "//pw_bluetooth_sapphire/host/hci:testing", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "hci_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":hci_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/iso/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/iso/BUILD.bazel new file mode 100644 index 0000000000..390080ae79 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/iso/BUILD.bazel @@ -0,0 +1,44 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "iso_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/iso", + "//pw_bluetooth_sapphire/host/iso:iso_test.lib", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "iso_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":iso_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/l2cap/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/l2cap/BUILD.bazel new file mode 100644 index 0000000000..6ec8177b1b --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/l2cap/BUILD.bazel @@ -0,0 +1,50 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "l2cap_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_async:fake_dispatcher_fixture", + "//pw_bluetooth_sapphire/host/hci", + "//pw_bluetooth_sapphire/host/hci:testing", + "//pw_bluetooth_sapphire/host/l2cap", + "//pw_bluetooth_sapphire/host/l2cap:channel_manager_mock_controller_test_fixture", + "//pw_bluetooth_sapphire/host/l2cap:l2cap_test.lib", + "//pw_bluetooth_sapphire/host/l2cap:testing", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + "//pw_bluetooth_sapphire/host/transport:testing", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "l2cap_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":l2cap_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/sco/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/sco/BUILD.bazel new file mode 100644 index 0000000000..aaa94991f3 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/sco/BUILD.bazel @@ -0,0 +1,45 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "sco_test", + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/hci:testing", + "//pw_bluetooth_sapphire/host/sco", + "//pw_bluetooth_sapphire/host/sco:sco_test.lib", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + "//pw_bluetooth_sapphire/host/transport:testing", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "sco_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":sco_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/sdp/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/sdp/BUILD.bazel new file mode 100644 index 0000000000..bb70ff3cf3 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/sdp/BUILD.bazel @@ -0,0 +1,46 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "sdp_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/common", + "//pw_bluetooth_sapphire/host/l2cap:testing", + "//pw_bluetooth_sapphire/host/sdp", + "//pw_bluetooth_sapphire/host/sdp:sdp_test.lib", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "sdp_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":sdp_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/sm/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/sm/BUILD.bazel new file mode 100644 index 0000000000..9caab9c235 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/sm/BUILD.bazel @@ -0,0 +1,47 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "sm_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/hci:testing", + "//pw_bluetooth_sapphire/host/l2cap:testing", + "//pw_bluetooth_sapphire/host/sm", + "//pw_bluetooth_sapphire/host/sm:sm_test.lib", + "//pw_bluetooth_sapphire/host/sm:testing", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "sm_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":sm_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/testing/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/testing/BUILD.bazel new file mode 100644 index 0000000000..bf66f2ce93 --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/testing/BUILD.bazel @@ -0,0 +1,44 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "testing_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/l2cap:testing", + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + "//pw_bluetooth_sapphire/host/testing:testing_test.lib", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "testing_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":testing_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host/transport/BUILD.bazel b/pw_bluetooth_sapphire/fuchsia/host/transport/BUILD.bazel new file mode 100644 index 0000000000..b2ccda94ba --- /dev/null +++ b/pw_bluetooth_sapphire/fuchsia/host/transport/BUILD.bazel @@ -0,0 +1,44 @@ +# 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( + "@fuchsia_sdk//fuchsia:defs.bzl", + "fuchsia_cc_test", + "fuchsia_unittest_package", +) +load("//pw_build:compatibility.bzl", "incompatible_with_mcu") + +fuchsia_cc_test( + name = "transport_test", + death_unittest = True, + # TODO: b/310957361 - gtest not supported on device + target_compatible_with = incompatible_with_mcu(), + deps = [ + "//pw_bluetooth_sapphire/host/testing", + "//pw_bluetooth_sapphire/host/testing:gtest_main", + "//pw_bluetooth_sapphire/host/transport", + "//pw_bluetooth_sapphire/host/transport:transport_test.lib", + ], +) + +fuchsia_unittest_package( + name = "test_pkg", + package_name = "transport_tests", + fuchsia_api_level = "22", + tags = ["manual"], + unit_tests = [ + ":transport_test", + ], + visibility = ["//visibility:public"], +) diff --git a/pw_bluetooth_sapphire/fuchsia/host_x64.bzl b/pw_bluetooth_sapphire/fuchsia/host_x64.bzl deleted file mode 100644 index eac7875294..0000000000 --- a/pw_bluetooth_sapphire/fuchsia/host_x64.bzl +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -"""Allows targets to be marked manual if the host/exec architecture is incompatible (non-x64).""" - -load("@host_metadata//:host_metadata.bzl", "HOST_ARCH", "HOST_OS") - -MANUAL_IF_NOT_LINUX_X64 = ["integration"] if HOST_ARCH == "amd64" and HOST_OS == "linux" else ["manual"] diff --git a/pw_bluetooth_sapphire/host/att/BUILD.bazel b/pw_bluetooth_sapphire/host/att/BUILD.bazel index 449813faac..abc926fc6f 100644 --- a/pw_bluetooth_sapphire/host/att/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/att/BUILD.bazel @@ -12,22 +12,15 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "definitions", srcs = [ "packet.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -47,9 +40,6 @@ cc_library( "write_queue.cc", ], copts = ["-Wswitch-enum"], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ ":definitions", "//pw_bluetooth_sapphire/host/l2cap", @@ -59,8 +49,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "att_test", +cc_library( + name = "att_test.lib", testonly = True, srcs = [ "attribute_test.cc", @@ -69,7 +59,7 @@ fuchsia_cc_test( "error_test.cc", "permissions_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":att", @@ -77,14 +67,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "att_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":att_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/common/BUILD.bazel b/pw_bluetooth_sapphire/host/common/BUILD.bazel index 3cd059a687..565b7ac2d6 100644 --- a/pw_bluetooth_sapphire/host/common/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/common/BUILD.bazel @@ -14,13 +14,13 @@ load( "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", "fuchsia_select", - "fuchsia_unittest_package", ) package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "common", srcs = [ @@ -41,9 +41,13 @@ cc_library( "uuid.cc", ], copts = ["-Wswitch-enum"], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], + # 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_bluetooth_sapphire:config", "//pw_bluetooth_sapphire:public", @@ -75,8 +79,8 @@ cc_library( deps = [":common"], ) -fuchsia_cc_test( - name = "common_test", +cc_library( + name = "common_test.lib", testonly = True, srcs = [ "advertising_data_test.cc", @@ -99,7 +103,7 @@ fuchsia_cc_test( "weak_self_test.cc", "windowed_inspect_numeric_property_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":common", @@ -109,14 +113,3 @@ fuchsia_cc_test( "@pigweed//pw_async:fake_dispatcher_fixture", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "common_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":common_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/gap/BUILD.bazel b/pw_bluetooth_sapphire/host/gap/BUILD.bazel index 2f0b19772e..8507ff0925 100644 --- a/pw_bluetooth_sapphire/host/gap/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/gap/BUILD.bazel @@ -12,22 +12,15 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "definitions", srcs = [ "gap.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -68,9 +61,6 @@ cc_library( "-Wno-unused-parameter", "-Wswitch-enum", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ ":definitions", "//pw_bluetooth_sapphire:public", @@ -107,8 +97,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "gap_test", +cc_library( + name = "gap_test.lib", testonly = True, srcs = [ "adapter_test.cc", @@ -131,7 +121,7 @@ fuchsia_cc_test( "secure_simple_pairing_state_test.cc", "types_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":gap", @@ -146,14 +136,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "gap_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":gap_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/gatt/BUILD.bazel b/pw_bluetooth_sapphire/host/gatt/BUILD.bazel index cfe1386cdb..732d1bba40 100644 --- a/pw_bluetooth_sapphire/host/gatt/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/gatt/BUILD.bazel @@ -12,22 +12,15 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "definitions", srcs = [ "gatt_defs.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/att:definitions", @@ -51,9 +44,6 @@ cc_library( copts = [ "-Wno-unused-parameter", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ ":definitions", "//pw_bluetooth_sapphire:public", @@ -97,25 +87,14 @@ cc_library( ], ) -fuchsia_cc_test( - name = "gatt_test", +cc_library( + name = "gatt_test.lib", testonly = True, srcs = [ ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "gatt_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":gatt_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/hci-spec/BUILD.bazel b/pw_bluetooth_sapphire/host/hci-spec/BUILD.bazel index 0790314be9..1f39169d05 100644 --- a/pw_bluetooth_sapphire/host/hci-spec/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/hci-spec/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "hci-spec", srcs = [ @@ -27,9 +23,6 @@ cc_library( "util.cc", ], copts = ["-Wswitch-enum"], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:config", "//pw_bluetooth_sapphire:public", @@ -39,30 +32,16 @@ cc_library( ], ) -fuchsia_cc_test( - name = "hci_spec_test", - size = "small", +cc_library( + name = "hci-spec_test.lib", testonly = True, srcs = [ "util_test.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":hci-spec", "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "hci_spec_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":hci_spec_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/hci/BUILD.bazel b/pw_bluetooth_sapphire/host/hci/BUILD.bazel index e66bdc857e..8b6b69a369 100644 --- a/pw_bluetooth_sapphire/host/hci/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/hci/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "hci", srcs = [ @@ -45,9 +41,6 @@ cc_library( "-Wno-deprecated-this-capture", "-Wswitch-enum", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/transport", @@ -76,8 +69,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "hci_test", +cc_library( + name = "hci_test.lib", testonly = True, srcs = [ "advertising_handle_map_test.cc", @@ -92,7 +85,7 @@ fuchsia_cc_test( "low_energy_scanner_test.cc", "sequential_command_runner_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":hci", @@ -102,14 +95,3 @@ fuchsia_cc_test( "@pigweed//pw_bluetooth:emboss_hci_test", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "hci_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":hci_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/iso/BUILD.bazel b/pw_bluetooth_sapphire/host/iso/BUILD.bazel index 0a3206d9d8..348f0fdcdd 100644 --- a/pw_bluetooth_sapphire/host/iso/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/iso/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "iso", srcs = [ @@ -29,9 +25,6 @@ cc_library( copts = [ "-Wno-unused-parameter", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -40,15 +33,15 @@ cc_library( ], ) -fuchsia_cc_test( - name = "iso_test", +cc_library( + name = "iso_test.lib", testonly = True, srcs = [ "iso_common_test.cc", "iso_stream_manager_test.cc", "iso_stream_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":iso", @@ -56,14 +49,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "iso_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":iso_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/l2cap/BUILD.bazel b/pw_bluetooth_sapphire/host/l2cap/BUILD.bazel index 993f62a88a..dc4d971584 100644 --- a/pw_bluetooth_sapphire/host/l2cap/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/l2cap/BUILD.bazel @@ -12,19 +12,12 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "definitions", - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/hci-spec", @@ -67,7 +60,11 @@ cc_library( "-Wno-unused-parameter", "-Wswitch-enum", ], - target_compatible_with = ["@platforms//os:linux"], + target_compatible_with = select({ + "@platforms//os:fuchsia": [], + "@platforms//os:linux": [], + "//conditions:default": ["@platforms//:incompatible"], + }), deps = [ ":definitions", "//pw_bluetooth:emboss_l2cap_frames", @@ -119,8 +116,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "l2cap_test", +cc_library( + name = "l2cap_test.lib", testonly = True, srcs = [ "a2dp_offload_manager_test.cc", @@ -151,7 +148,7 @@ fuchsia_cc_test( "signaling_channel_test.cc", "types_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":channel_manager_mock_controller_test_fixture", @@ -165,14 +162,3 @@ fuchsia_cc_test( "@pigweed//pw_async:fake_dispatcher_fixture", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "l2cap_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":l2cap_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/sco/BUILD.bazel b/pw_bluetooth_sapphire/host/sco/BUILD.bazel index 4556a97467..2717c13e58 100644 --- a/pw_bluetooth_sapphire/host/sco/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/sco/BUILD.bazel @@ -12,23 +12,16 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "sco", srcs = [ "sco_connection.cc", "sco_connection_manager.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -38,13 +31,14 @@ cc_library( ], ) -fuchsia_cc_test( - name = "sco_test", +cc_library( + name = "sco_test.lib", testonly = True, srcs = [ "sco_connection_manager_test.cc", "sco_connection_test.cc", ], + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":sco", @@ -54,14 +48,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/transport:testing", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "sco_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":sco_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/sdp/BUILD.bazel b/pw_bluetooth_sapphire/host/sdp/BUILD.bazel index bc2a40bbde..fc66befbee 100644 --- a/pw_bluetooth_sapphire/host/sdp/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/sdp/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "definitions", srcs = [ @@ -27,9 +23,6 @@ cc_library( "error.cc", "service_record.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -44,9 +37,6 @@ cc_library( "server.cc", "service_discoverer.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ ":definitions", "//pw_bluetooth_sapphire:public", @@ -55,8 +45,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "sdp_test", +cc_library( + name = "_test.lib", testonly = True, srcs = [ "client_test.cc", @@ -66,7 +56,7 @@ fuchsia_cc_test( "service_discoverer_test.cc", "service_record_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":sdp", @@ -76,14 +66,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "sdp_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":sdp_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/sm/BUILD.bazel b/pw_bluetooth_sapphire/host/sm/BUILD.bazel index 3521370e93..de63f8c101 100644 --- a/pw_bluetooth_sapphire/host/sm/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/sm/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "definitions", srcs = [ @@ -28,9 +24,6 @@ cc_library( "types.cc", ], copts = ["-Wswitch-enum"], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -54,9 +47,6 @@ cc_library( "security_request_phase.cc", "util.cc", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ ":definitions", "//pw_bluetooth_sapphire:public", @@ -83,8 +73,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "sm_test", +cc_library( + name = "_test.lib", testonly = True, srcs = [ "ecdh_key_test.cc", @@ -103,7 +93,7 @@ fuchsia_cc_test( "types_test.cc", "util_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":sm", @@ -114,14 +104,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "sm_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":sm_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/testing/BUILD.bazel b/pw_bluetooth_sapphire/host/testing/BUILD.bazel index e485ed67ec..178afb22bb 100644 --- a/pw_bluetooth_sapphire/host/testing/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/testing/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "testing", testonly = True, @@ -154,8 +150,8 @@ cc_library( ], ) -fuchsia_cc_test( - name = "testing_test", +cc_library( + name = "_test.lib", testonly = True, srcs = [ "fake_controller_test.cc", @@ -166,7 +162,7 @@ fuchsia_cc_test( "inspect_util_test.cc", "parse_args_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":testing", @@ -174,14 +170,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "testing_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":testing_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_bluetooth_sapphire/host/transport/BUILD.bazel b/pw_bluetooth_sapphire/host/transport/BUILD.bazel index a1092e0ad1..3e8419e52d 100644 --- a/pw_bluetooth_sapphire/host/transport/BUILD.bazel +++ b/pw_bluetooth_sapphire/host/transport/BUILD.bazel @@ -12,14 +12,10 @@ # License for the specific language governing permissions and limitations under # the License. -load( - "@fuchsia_sdk//fuchsia:defs.bzl", - "fuchsia_cc_test", - "fuchsia_unittest_package", -) - package(default_visibility = ["//visibility:public"]) +exports_files(glob(["**/*"])) + cc_library( name = "transport", srcs = [ @@ -38,9 +34,6 @@ cc_library( copts = [ "-Wno-unused-parameter", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ "//pw_bluetooth_sapphire:public", "//pw_bluetooth_sapphire/host/common", @@ -63,9 +56,6 @@ cc_library( copts = [ "-Wno-unused-parameter", ], - # TODO: https://pwbug.dev/313665184 - Re-enable for all platforms once Mac - # builder issue is resolved. - target_compatible_with = ["@platforms//os:linux"], deps = [ ":transport", "//pw_bluetooth_sapphire:public", @@ -89,8 +79,8 @@ filegroup( ], ) -fuchsia_cc_test( - name = "transport_test", +cc_library( + name = "_test.lib", testonly = True, srcs = [ "acl_data_channel_test.cc", @@ -104,7 +94,7 @@ fuchsia_cc_test( "slab_allocators_test.cc", "transport_test.cc", ], - death_unittest = True, + tags = ["manual"], visibility = ["//visibility:public"], deps = [ ":transport", @@ -112,14 +102,3 @@ fuchsia_cc_test( "//pw_bluetooth_sapphire/host/testing:gtest_main", ], ) - -fuchsia_unittest_package( - name = "test_pkg", - package_name = "transport_tests", - testonly = True, - fuchsia_api_level = "HEAD", - unit_tests = [ - ":transport_test", - ], - visibility = ["//visibility:public"], -) diff --git a/pw_env_setup/bazel/host_metadata_repository.bzl b/pw_env_setup/bazel/host_metadata_repository.bzl deleted file mode 100644 index 121df78a17..0000000000 --- a/pw_env_setup/bazel/host_metadata_repository.bzl +++ /dev/null @@ -1,27 +0,0 @@ -# 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. - -"""Intializes a workspace with information about the host os and arch.""" - -def _host_metadata_repository_impl(rctx): - rctx.file("BUILD.bazel", "exports_files(glob(['**/*']))") - rctx.file("host_metadata.bzl", """ -HOST_OS = "%s" -HOST_ARCH = "%s" -""" % (rctx.os.name, rctx.os.arch)) - -host_metadata_repository = repository_rule( - implementation = _host_metadata_repository_impl, - doc = "Intializes a workspace with information about the host os and arch.", -)