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( 16 "//pw_build:pigweed.bzl", 17 "pw_cc_test", 18) 19load("//pw_build:selects.bzl", "TARGET_COMPATIBLE_WITH_HOST_SELECT") 20 21package(default_visibility = ["//visibility:public"]) 22 23licenses(["notice"]) 24 25# Backend for //pw_async:task 26cc_library( 27 name = "task", 28 hdrs = [ 29 "public/pw_async_basic/task.h", 30 "public_overrides/pw_async_backend/task.h", 31 ], 32 includes = [ 33 "public", 34 "public_overrides", 35 ], 36 deps = [ 37 "//pw_async:task_facade", 38 "//pw_containers:intrusive_list", 39 ], 40) 41 42# Backend for //pw_async:fake_dispatcher 43cc_library( 44 name = "fake_dispatcher", 45 srcs = ["fake_dispatcher.cc"], 46 hdrs = [ 47 "public/pw_async_basic/fake_dispatcher.h", 48 "public_overrides/pw_async_backend/fake_dispatcher.h", 49 ], 50 includes = [ 51 "public", 52 "public_override", 53 ], 54 deps = [ 55 "//pw_async:fake_dispatcher_facade", 56 "//pw_async:task", 57 "//pw_log", 58 ], 59) 60 61pw_cc_test( 62 name = "fake_dispatcher_fixture_test", 63 srcs = ["fake_dispatcher_fixture_test.cc"], 64 deps = ["//pw_async:fake_dispatcher_fixture"], 65) 66 67cc_library( 68 name = "dispatcher", 69 srcs = ["dispatcher.cc"], 70 hdrs = ["public/pw_async_basic/dispatcher.h"], 71 includes = ["public"], 72 deps = [ 73 "//pw_async:dispatcher", 74 "//pw_async:task", 75 "//pw_containers:intrusive_list", 76 "//pw_sync:interrupt_spin_lock", 77 "//pw_sync:timed_thread_notification", 78 "//pw_thread:thread_core", 79 ], 80) 81 82pw_cc_test( 83 name = "dispatcher_test", 84 srcs = ["dispatcher_test.cc"], 85 # TODO: b/343776800 - update to run on all compatible devices 86 target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), 87 deps = [ 88 ":dispatcher", 89 "//pw_log", 90 "//pw_thread:thread", 91 ], 92) 93 94pw_cc_test( 95 name = "heap_dispatcher_test", 96 srcs = ["heap_dispatcher_test.cc"], 97 deps = [ 98 "//pw_async:fake_dispatcher_fixture", 99 "//pw_async:heap_dispatcher", 100 ], 101) 102