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("//pw_build:pw_facade.bzl", "pw_facade") 16load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test") 17 18package(default_visibility = ["//visibility:public"]) 19 20licenses(["notice"]) 21 22cc_library( 23 name = "dispatcher", 24 hdrs = [ 25 "public/pw_async/dispatcher.h", 26 "public/pw_async/function_dispatcher.h", 27 ], 28 strip_include_prefix = "public", 29 deps = [ 30 ":types", 31 "//pw_chrono:system_clock", 32 "//pw_function", 33 "//pw_status", 34 ], 35) 36 37pw_facade( 38 name = "task", 39 hdrs = ["public/pw_async/task.h"], 40 backend = ":task_backend", 41 strip_include_prefix = "public", 42 deps = [ 43 ":types", 44 "//pw_chrono:system_clock", 45 "//pw_function", 46 "//pw_status", 47 ], 48) 49 50label_flag( 51 name = "task_backend", 52 build_setting_default = "//pw_async_basic:task", 53) 54 55cc_library( 56 name = "types", 57 hdrs = [ 58 "public/pw_async/context.h", 59 "public/pw_async/task_function.h", 60 ], 61 strip_include_prefix = "public", 62 deps = [ 63 "//pw_function", 64 "//pw_status", 65 ], 66) 67 68pw_facade( 69 name = "fake_dispatcher", 70 hdrs = ["public/pw_async/fake_dispatcher.h"], 71 backend = ":fake_dispatcher_backend", 72 strip_include_prefix = "public", 73 deps = [ 74 ":dispatcher", 75 ], 76) 77 78label_flag( 79 name = "fake_dispatcher_backend", 80 build_setting_default = "//pw_async_basic:fake_dispatcher", 81) 82 83pw_cc_test( 84 name = "fake_dispatcher_test", 85 srcs = ["fake_dispatcher_test.cc"], 86 deps = [ 87 ":fake_dispatcher", 88 "//pw_containers:vector", 89 "//pw_log", 90 "//pw_string:to_string", 91 "//pw_sync:timed_thread_notification", 92 "//pw_thread:thread", 93 ], 94) 95 96cc_library( 97 name = "fake_dispatcher_fixture", 98 hdrs = ["public/pw_async/fake_dispatcher_fixture.h"], 99 strip_include_prefix = "public", 100 deps = [":fake_dispatcher"], 101) 102 103cc_library( 104 name = "heap_dispatcher", 105 srcs = ["heap_dispatcher.cc"], 106 hdrs = ["public/pw_async/heap_dispatcher.h"], 107 strip_include_prefix = "public", 108 deps = [ 109 ":dispatcher", 110 ":task", 111 ":types", 112 "//pw_result", 113 ], 114) 115 116filegroup( 117 name = "doxygen", 118 srcs = [ 119 "public/pw_async/context.h", 120 "public/pw_async/dispatcher.h", 121 "public/pw_async/fake_dispatcher_fixture.h", 122 "public/pw_async/function_dispatcher.h", 123 "public/pw_async/heap_dispatcher.h", 124 "public/pw_async/task.h", 125 "public/pw_async/task_function.h", 126 ], 127) 128