xref: /aosp_15_r20/external/pigweed/pw_rpc/raw/BUILD.bazel (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1# Copyright 2020 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_unit_test:pw_cc_test.bzl", "pw_cc_test")
16
17package(default_visibility = ["//visibility:public"])
18
19licenses(["notice"])
20
21cc_library(
22    name = "server_api",
23    srcs = [
24        "method.cc",
25    ],
26    hdrs = [
27        "public/pw_rpc/raw/internal/method.h",
28        "public/pw_rpc/raw/internal/method_union.h",
29        "public/pw_rpc/raw/server_reader_writer.h",
30    ],
31    strip_include_prefix = "public",
32    deps = [
33        "//pw_bytes",
34        "//pw_rpc",
35        "//pw_rpc:internal_packet_pwpb",
36        "//pw_status",
37    ],
38)
39
40cc_library(
41    name = "client_api",
42    hdrs = ["public/pw_rpc/raw/client_reader_writer.h"],
43    strip_include_prefix = "public",
44    deps = [
45        "//pw_bytes",
46        "//pw_rpc",
47        "//pw_rpc:internal_packet_pwpb",
48    ],
49)
50
51cc_library(
52    name = "fake_channel_output",
53    hdrs = ["public/pw_rpc/raw/fake_channel_output.h"],
54    strip_include_prefix = "public",
55    deps = [
56        ":server_api",
57        "//pw_assert",
58        "//pw_containers",
59    ],
60)
61
62cc_library(
63    name = "test_method_context",
64    hdrs = ["public/pw_rpc/raw/test_method_context.h"],
65    strip_include_prefix = "public",
66    deps = [
67        ":fake_channel_output",
68        ":server_api",
69        "//pw_assert",
70        "//pw_containers:vector",
71        "//pw_preprocessor",
72        "//pw_rpc",
73        "//pw_rpc:internal_test_utils",
74    ],
75)
76
77cc_library(
78    name = "client_testing",
79    srcs = ["client_testing.cc"],
80    hdrs = ["public/pw_rpc/raw/client_testing.h"],
81    strip_include_prefix = "public",
82    deps = [
83        ":test_method_context",
84        "//pw_assert",
85        "//pw_bytes",
86        "//pw_log",
87        "//pw_rpc",
88    ],
89)
90
91pw_cc_test(
92    name = "client_test",
93    srcs = [
94        "client_test.cc",
95    ],
96    deps = [
97        ":client_api",
98        ":client_testing",
99        "//pw_rpc:internal_test_utils",
100    ],
101)
102
103pw_cc_test(
104    name = "client_reader_writer_test",
105    srcs = ["client_reader_writer_test.cc"],
106    deps = [
107        ":client_api",
108        ":client_testing",
109        "//pw_rpc:pw_rpc_test_raw_rpc",
110    ],
111)
112
113pw_cc_test(
114    name = "codegen_test",
115    srcs = [
116        "codegen_test.cc",
117    ],
118    deps = [
119        ":client_api",
120        ":client_testing",
121        ":server_api",
122        ":test_method_context",
123        "//pw_protobuf",
124        "//pw_rpc:internal_test_utils",
125        "//pw_rpc:pw_rpc_test_pwpb",
126        "//pw_rpc:pw_rpc_test_raw_rpc",
127    ],
128)
129
130pw_cc_test(
131    name = "method_test",
132    srcs = [
133        "method_test.cc",
134    ],
135    deps = [
136        ":server_api",
137        "//pw_containers",
138        "//pw_protobuf",
139        "//pw_rpc:internal_test_utils",
140        "//pw_rpc:pw_rpc_test_pwpb",
141    ],
142)
143
144pw_cc_test(
145    name = "method_info_test",
146    srcs = [
147        "method_info_test.cc",
148    ],
149    deps = [
150        "//pw_rpc:internal_test_utils",
151        "//pw_rpc:pw_rpc_test_raw_rpc",
152    ],
153)
154
155pw_cc_test(
156    name = "method_union_test",
157    srcs = [
158        "method_union_test.cc",
159    ],
160    deps = [
161        ":server_api",
162        "//pw_protobuf",
163        "//pw_rpc:internal_test_utils",
164        "//pw_rpc:pw_rpc_test_pwpb",
165    ],
166)
167
168pw_cc_test(
169    name = "server_reader_writer_test",
170    srcs = ["server_reader_writer_test.cc"],
171    deps = [
172        ":test_method_context",
173        "//pw_rpc:internal_test_utils",
174        "//pw_rpc:pw_rpc_test_pwpb",
175        "//pw_rpc:pw_rpc_test_raw_rpc",
176    ],
177)
178
179# Negative compilation testing is not supported by Bazel. Build this as a
180# regular unit for now test.
181pw_cc_test(
182    name = "service_nc_test",
183    srcs = ["service_nc_test.cc"],
184    deps = ["//pw_rpc:pw_rpc_test_raw_rpc"],
185)
186
187pw_cc_test(
188    name = "stub_generation_test",
189    srcs = ["stub_generation_test.cc"],
190    deps = [
191        "//pw_rpc:pw_rpc_test_pwpb",
192        "//pw_rpc:pw_rpc_test_raw_rpc",
193    ],
194)
195
196pw_cc_test(
197    name = "synchronous_call_test",
198    srcs = ["synchronous_call_test.cc"],
199    deps = [
200        ":test_method_context",
201        "//pw_rpc:pw_rpc_test_raw_rpc",
202        "//pw_rpc:synchronous_client_api",
203        "//pw_work_queue",
204        "//pw_work_queue:stl_test_thread",
205        "//pw_work_queue:test_thread_header",
206    ],
207)
208