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