1# Copyright 2023 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("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library") 17load("//pw_build:compatibility.bzl", "incompatible_with_mcu") 18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 19 20package( 21 default_visibility = ["//visibility:public"], 22) 23 24licenses(["notice"]) 25 26# Backend for //pw_async:task 27cc_library( 28 name = "task", 29 hdrs = [ 30 "public_overrides/pw_async_backend/task.h", 31 ], 32 strip_include_prefix = "public_overrides", 33 deps = [ 34 ":task_private", 35 ], 36) 37 38cc_library( 39 name = "task_private", 40 hdrs = [ 41 "public/pw_async_basic/task.h", 42 ], 43 strip_include_prefix = "public", 44 visibility = ["//visibility:private"], 45 deps = [ 46 "//pw_async:types", 47 "//pw_chrono:system_clock", 48 "//pw_containers:intrusive_list", 49 ], 50) 51 52# Backend for //pw_async:fake_dispatcher 53cc_library( 54 name = "fake_dispatcher", 55 testonly = True, 56 srcs = ["fake_dispatcher.cc"], 57 hdrs = [ 58 "public_overrides/pw_async_backend/fake_dispatcher.h", 59 ], 60 strip_include_prefix = "public_overrides", 61 deps = [ 62 ":fake_dispatcher_private", 63 "//pw_async:fake_dispatcher.facade", 64 "//pw_async:task", 65 "//pw_log", 66 ], 67) 68 69cc_library( 70 name = "fake_dispatcher_private", 71 testonly = True, 72 hdrs = [ 73 "public/pw_async_basic/fake_dispatcher.h", 74 ], 75 strip_include_prefix = "public", 76 tags = ["noclangtidy"], 77 visibility = ["//visibility:private"], 78 deps = [ 79 "//pw_async:fake_dispatcher.facade", 80 "//pw_containers:intrusive_list", 81 ], 82) 83 84pw_cc_test( 85 name = "fake_dispatcher_fixture_test", 86 srcs = ["fake_dispatcher_fixture_test.cc"], 87 deps = ["//pw_async:fake_dispatcher_fixture"], 88) 89 90cc_library( 91 name = "dispatcher", 92 srcs = ["dispatcher.cc"], 93 hdrs = ["public/pw_async_basic/dispatcher.h"], 94 strip_include_prefix = "public", 95 deps = [ 96 "//pw_async:dispatcher", 97 "//pw_async:task", 98 "//pw_chrono:system_clock", 99 "//pw_sync:interrupt_spin_lock", 100 "//pw_sync:lock_annotations", 101 "//pw_sync:timed_thread_notification", 102 "//pw_thread:thread_core", 103 ], 104) 105 106pw_cc_test( 107 name = "dispatcher_test", 108 srcs = ["dispatcher_test.cc"], 109 # TODO: b/343776800 - update to run on all compatible devices 110 target_compatible_with = incompatible_with_mcu(), 111 deps = [ 112 ":dispatcher", 113 "//pw_chrono:system_clock", 114 "//pw_log", 115 "//pw_span", 116 "//pw_sync:thread_notification", 117 "//pw_thread:thread", 118 "//pw_thread_stl:options", 119 ], 120) 121 122pw_cc_test( 123 name = "heap_dispatcher_test", 124 srcs = ["heap_dispatcher_test.cc"], 125 deps = [ 126 "//pw_async:fake_dispatcher_fixture", 127 "//pw_async:heap_dispatcher", 128 ], 129) 130 131filegroup( 132 name = "doxygen", 133 srcs = [ 134 "public/pw_async_basic/dispatcher.h", 135 ], 136) 137 138sphinx_docs_library( 139 name = "docs", 140 srcs = [ 141 "docs.rst", 142 ], 143 prefix = "pw_async_basic/", 144 target_compatible_with = incompatible_with_mcu(), 145) 146