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