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 15# Contains a stub Fuchsia bt-host component. 16# Eventually the real bt-host component will be migrated here: 17# https://fuchsia.googlesource.com/fuchsia/+/refs/heads/main/src/connectivity/bluetooth/core/bt-host/ 18# See https://fxbug.dev/321267390. 19 20load("@fuchsia_infra//infra:infra.bzl", "fuchsia_cipd_releases") 21load( 22 "@fuchsia_sdk//fuchsia:defs.bzl", 23 "fuchsia_cc_binary", 24 "fuchsia_cc_test", 25 "fuchsia_component", 26 "fuchsia_component_manifest", 27 "fuchsia_package", 28 "fuchsia_platforms", 29 "fuchsia_unittest_package", 30) 31load( 32 "@fuchsia_sdk//fuchsia:licenses.bzl", 33 "fuchsia_licenses_collection", 34 "fuchsia_licenses_spdx", 35) 36load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT") 37 38package( 39 default_applicable_licenses = ["//pw_bluetooth_sapphire/fuchsia:license_fuchsia"], 40 default_visibility = ["//pw_bluetooth_sapphire/fuchsia:__pkg__"], 41) 42 43exports_files(["README.fuchsia.md"]) 44 45fuchsia_cc_binary( 46 name = "hello_world", 47 srcs = [ 48 "hello_world.cc", 49 ], 50 deps = [ 51 "@fuchsia_sdk//pkg/fdio", 52 "@fuchsia_sdk//pkg/syslog", 53 ], 54) 55 56fuchsia_component_manifest( 57 name = "manifest", 58 src = "meta/bt-host.cml", 59) 60 61fuchsia_component( 62 name = "component", 63 manifest = ":manifest", 64 deps = [":hello_world"], 65) 66 67fuchsia_cc_test( 68 name = "hello_gtest", 69 size = "small", 70 srcs = ["hello_gtest.cc"], 71 # TODO: b/310957361 - gtest not supported on device 72 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 73 deps = [ 74 "@com_google_googletest//:gtest_main", 75 "@fuchsia_sdk//pkg/fdio", 76 "@fuchsia_sdk//pkg/syslog", 77 ], 78) 79 80fuchsia_unittest_package( 81 name = "unittest_pkg", 82 package_name = "bt-host-unittests", 83 fuchsia_api_level = "HEAD", 84 platform = fuchsia_platforms.x64, 85 tags = ["manual"], 86 unit_tests = [ 87 ":hello_gtest", 88 ], 89) 90 91fuchsia_package( 92 name = "pkg.x64", 93 package_name = "bt-host", 94 components = [ 95 ":component", 96 ], 97 fuchsia_api_level = "HEAD", 98 platform = fuchsia_platforms.x64, 99 tags = ["manual"], 100) 101 102fuchsia_package( 103 name = "pkg.arm64", 104 package_name = "bt-host", 105 components = [ 106 ":component", 107 ], 108 fuchsia_api_level = "HEAD", 109 platform = fuchsia_platforms.arm64, 110 tags = ["manual"], 111) 112 113fuchsia_licenses_collection( 114 name = "bt_host_x64_pkg_licenses_collection", 115 root_target = ":pkg.x64", 116 tags = ["manual"], 117) 118 119fuchsia_licenses_collection( 120 name = "bt_host_arm64_pkg_licenses_collection", 121 root_target = ":pkg.arm64", 122 tags = ["manual"], 123) 124 125fuchsia_licenses_spdx( 126 name = "bt_host_x64_licenses.spdx.json", 127 document_namespace = "https://pigweed.dev/pw_bluetooth_sapphire/", 128 licenses = ":bt_host_x64_pkg_licenses_collection", 129 licenses_cross_refs_base_url = "https://pigweed.googlesource.com/pigweed/pigweed/+/refs/heads/main/pw_bluetooth_sapphire/fuchsia/", 130 root_package_homepage = "https://pigweed.dev/pw_bluetooth_sapphire/", 131 root_package_name = "bt-host", 132 tags = ["manual"], 133) 134 135fuchsia_licenses_spdx( 136 name = "bt_host_arm64_licenses.spdx.json", 137 document_namespace = "https://pigweed.dev/pw_bluetooth_sapphire/", 138 licenses = ":bt_host_arm64_pkg_licenses_collection", 139 licenses_cross_refs_base_url = "https://pigweed.googlesource.com/pigweed/pigweed/+/refs/heads/main/pw_bluetooth_sapphire/fuchsia/", 140 root_package_homepage = "https://pigweed.dev/pw_bluetooth_sapphire/", 141 root_package_name = "bt-host", 142 tags = ["manual"], 143) 144 145fuchsia_cipd_releases( 146 name = "bt_host_x64_cipd", 147 cipd_prefix = "fuchsia/prebuilt/bt-host", 148 extra_content = { 149 ":README.fuchsia.md": "README.fuchsia", 150 ":bt_host_x64_licenses.spdx.json": "licenses.spdx.json", 151 }, 152 pkg = ":pkg.x64", 153) 154 155fuchsia_cipd_releases( 156 name = "bt_host_arm64_cipd", 157 cipd_prefix = "fuchsia/prebuilt/bt-host", 158 extra_content = { 159 ":README.fuchsia.md": "README.fuchsia", 160 ":bt_host_arm64_licenses.spdx.json": "licenses.spdx.json", 161 }, 162 pkg = ":pkg.arm64", 163) 164