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("@rules_cc//cc:cc_library.bzl", "cc_library") 16load( 17 "@rules_fuchsia//fuchsia:defs.bzl", 18 "fuchsia_cc_test", 19 "fuchsia_unittest_package", 20) 21load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 22load("//pw_bluetooth_sapphire/fuchsia:fuchsia_api_level.bzl", "FUCHSIA_API_LEVEL") 23load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 24 25package(default_visibility = ["//visibility:public"]) 26 27licenses(["notice"]) 28 29# Backend for pw_async:task 30cc_library( 31 name = "task", 32 srcs = [ 33 "task.cc", 34 ], 35 hdrs = [ 36 "public/pw_async_fuchsia/task.h", 37 "public_overrides/pw_async_backend/task.h", 38 ], 39 includes = [ 40 "public", 41 "public_overrides", 42 ], 43 target_compatible_with = ["@platforms//os:fuchsia"], 44 deps = [ 45 ":util", 46 "//pw_async:task.facade", 47 "@fuchsia_sdk//pkg/async-loop-default", 48 "@fuchsia_sdk//pkg/zx", 49 ], 50) 51 52# Backend for pw_async:fake_dispatcher 53cc_library( 54 name = "fake_dispatcher", 55 testonly = True, 56 srcs = [ 57 "fake_dispatcher.cc", 58 ], 59 hdrs = [ 60 "public/pw_async_fuchsia/fake_dispatcher.h", 61 "public_overrides/pw_async_backend/fake_dispatcher.h", 62 ], 63 includes = [ 64 "public", 65 "public_overrides", 66 ], 67 deps = [ 68 ":task", 69 "//pw_async:fake_dispatcher.facade", 70 ], 71) 72 73cc_library( 74 name = "dispatcher", 75 srcs = [ 76 "dispatcher.cc", 77 ], 78 hdrs = [ 79 "public/pw_async_fuchsia/dispatcher.h", 80 ], 81 includes = [ 82 "public", 83 "public_overrides", 84 ], 85 deps = [ 86 ":task", 87 "//pw_async:dispatcher", 88 "@fuchsia_sdk//pkg/async-cpp", 89 ], 90) 91 92cc_library( 93 name = "util", 94 hdrs = [ 95 "public/pw_async_fuchsia/util.h", 96 ], 97 includes = [ 98 "public", 99 "public_overrides", 100 ], 101 tags = ["noclangtidy"], 102) 103 104fuchsia_cc_test( 105 name = "pw_async_fuchsia_test", 106 srcs = [ 107 "dispatcher_test.cc", 108 "fake_dispatcher_fixture_test.cc", 109 ], 110 deps = [ 111 ":dispatcher", 112 "//pw_async:fake_dispatcher_fixture", 113 "//pw_unit_test", 114 "//pw_unit_test:printf_main", 115 "@fuchsia_sdk//pkg/async-testing", 116 ], 117) 118 119fuchsia_unittest_package( 120 name = "test_pkg", 121 package_name = "pw_async_fuchsia_tests", 122 fuchsia_api_level = FUCHSIA_API_LEVEL, 123 tags = ["manual"], 124 unit_tests = [":pw_async_fuchsia_test"], 125) 126 127sphinx_docs_library( 128 name = "docs", 129 srcs = [ 130 "docs.rst", 131 ], 132 prefix = "pw_async_fuchsia/", 133 target_compatible_with = incompatible_with_mcu(), 134) 135