xref: /aosp_15_r20/external/pigweed/pw_async_fuchsia/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2024 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    "@fuchsia_sdk//fuchsia:defs.bzl",
17    "fuchsia_cc_test",
18    "fuchsia_unittest_package",
19)
20load("//pw_bluetooth_sapphire/fuchsia:fuchsia_api_level.bzl", "FUCHSIA_API_LEVEL")
21
22package(default_visibility = ["//visibility:public"])
23
24licenses(["notice"])
25
26# Backend for pw_async:task
27cc_library(
28    name = "task",
29    srcs = [
30        "task.cc",
31    ],
32    hdrs = [
33        "public/pw_async_fuchsia/task.h",
34        "public_overrides/pw_async_backend/task.h",
35    ],
36    includes = [
37        "public",
38        "public_overrides",
39    ],
40    target_compatible_with = ["@platforms//os:fuchsia"],
41    deps = [
42        ":util",
43        "//pw_async:task.facade",
44        "@fuchsia_sdk//pkg/async-loop-default",
45        "@fuchsia_sdk//pkg/zx",
46    ],
47)
48
49# Backend for pw_async:fake_dispatcher
50cc_library(
51    name = "fake_dispatcher",
52    srcs = [
53        "fake_dispatcher.cc",
54    ],
55    hdrs = [
56        "public/pw_async_fuchsia/fake_dispatcher.h",
57        "public_overrides/pw_async_backend/fake_dispatcher.h",
58    ],
59    includes = [
60        "public",
61        "public_overrides",
62    ],
63    deps = [
64        ":task",
65        "//pw_async:fake_dispatcher.facade",
66    ],
67)
68
69cc_library(
70    name = "dispatcher",
71    srcs = [
72        "dispatcher.cc",
73    ],
74    hdrs = [
75        "public/pw_async_fuchsia/dispatcher.h",
76    ],
77    includes = [
78        "public",
79        "public_overrides",
80    ],
81    deps = [
82        ":task",
83        "//pw_async:dispatcher",
84        "@fuchsia_sdk//pkg/async-cpp",
85    ],
86)
87
88cc_library(
89    name = "util",
90    hdrs = [
91        "public/pw_async_fuchsia/util.h",
92    ],
93    includes = [
94        "public",
95        "public_overrides",
96    ],
97)
98
99fuchsia_cc_test(
100    name = "pw_async_fuchsia_test",
101    srcs = [
102        "dispatcher_test.cc",
103        "fake_dispatcher_fixture_test.cc",
104    ],
105    deps = [
106        ":dispatcher",
107        "//pw_async:fake_dispatcher_fixture",
108        "//pw_unit_test",
109        "//pw_unit_test:printf_main",
110        "@fuchsia_sdk//pkg/async-testing",
111    ],
112)
113
114fuchsia_unittest_package(
115    name = "test_pkg",
116    package_name = "pw_async_fuchsia_tests",
117    fuchsia_api_level = FUCHSIA_API_LEVEL,
118    tags = ["manual"],
119    unit_tests = [":pw_async_fuchsia_test"],
120)
121
122# Bazel does not yet support building docs.
123filegroup(
124    name = "docs",
125    srcs = ["docs.rst"],
126)
127