• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 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("@rules_cc//cc:cc_library.bzl", "cc_library")
16load("@rules_python//sphinxdocs:sphinx_docs_library.bzl", "sphinx_docs_library")
17load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
18load("//pw_unit_test:pw_cc_test.bzl", "pw_cc_test")
19
20package(
21    default_visibility = ["//visibility:public"],
22    features = ["-layering_check"],
23)
24
25licenses(["notice"])
26
27cc_library(
28    name = "server_api",
29    srcs = [
30        "server_reader_writer.cc",
31    ],
32    hdrs = [
33        "public/pw_rpc/pwpb/internal/method.h",
34        "public/pw_rpc/pwpb/internal/method_union.h",
35        "public/pw_rpc/pwpb/server_reader_writer.h",
36    ],
37    strip_include_prefix = "public",
38    deps = [
39        ":common",
40        "//pw_rpc/raw:server_api",
41    ],
42)
43
44cc_library(
45    name = "client_api",
46    hdrs = [
47        "public/pw_rpc/pwpb/client_reader_writer.h",
48    ],
49    strip_include_prefix = "public",
50    deps = [
51        ":common",
52    ],
53)
54
55cc_library(
56    name = "common",
57    hdrs = [
58        "public/pw_rpc/pwpb/internal/common.h",
59        "public/pw_rpc/pwpb/serde.h",
60        "public/pw_rpc/pwpb/server_reader_writer.h",
61    ],
62    strip_include_prefix = "public",
63    deps = [
64        "//pw_assert:assert",
65        "//pw_rpc",
66    ],
67)
68
69cc_library(
70    name = "test_method_context",
71    hdrs = [
72        "public/pw_rpc/pwpb/fake_channel_output.h",
73        "public/pw_rpc/pwpb/test_method_context.h",
74    ],
75    strip_include_prefix = "public",
76    deps = [
77        ":common",
78        ":server_api",
79        "//pw_rpc:internal_test_utils",
80        "//pw_span",
81    ],
82)
83
84cc_library(
85    name = "client_testing",
86    hdrs = [
87        "public/pw_rpc/pwpb/client_testing.h",
88    ],
89    strip_include_prefix = "public",
90    deps = [
91        ":test_method_context",
92        "//pw_rpc",
93        "//pw_rpc/raw:client_testing",
94    ],
95)
96
97cc_library(
98    name = "client_server_testing",
99    hdrs = [
100        "public/pw_rpc/pwpb/client_server_testing.h",
101    ],
102    strip_include_prefix = "public",
103    deps = [
104        ":test_method_context",
105        "//pw_assert:assert",
106        "//pw_rpc:client_server_testing",
107    ],
108)
109
110cc_library(
111    name = "client_server_testing_threaded",
112    hdrs = [
113        "public/pw_rpc/pwpb/client_server_testing_threaded.h",
114    ],
115    strip_include_prefix = "public",
116    deps = [
117        ":test_method_context",
118        "//pw_rpc:client_server_testing_threaded",
119    ],
120)
121
122cc_library(
123    name = "internal_test_utils",
124    hdrs = ["pw_rpc_pwpb_private/internal_test_utils.h"],
125    deps = ["//pw_rpc:internal_test_utils"],
126)
127
128cc_library(
129    name = "echo_service",
130    hdrs = ["public/pw_rpc/echo_service_pwpb.h"],
131    strip_include_prefix = "public",
132    deps = [
133        "//pw_rpc:echo_pwpb_rpc",
134    ],
135)
136
137# TODO: b/242059613 - Enable this library when logging_event_handler can be used.
138filegroup(
139    name = "client_integration_test",
140    srcs = [
141        "client_integration_test.cc",
142    ],
143    #deps = [
144    #    "//pw_rpc:integration_testing",
145    #    "//pw_sync:binary_semaphore",
146    #    "//pw_rpc:benchmark_pwpb_rpc",
147    #]
148)
149
150pw_cc_test(
151    name = "client_call_test",
152    srcs = [
153        "client_call_test.cc",
154    ],
155    deps = [
156        ":client_api",
157        ":internal_test_utils",
158        "//pw_rpc",
159        "//pw_rpc:pw_rpc_test_pwpb",
160    ],
161)
162
163pw_cc_test(
164    name = "client_reader_writer_test",
165    srcs = [
166        "client_reader_writer_test.cc",
167    ],
168    deps = [
169        ":client_api",
170        ":client_testing",
171        "//pw_rpc:pw_rpc_test_pwpb_rpc",
172    ],
173)
174
175pw_cc_test(
176    name = "client_server_context_test",
177    srcs = [
178        "client_server_context_test.cc",
179    ],
180    deps = [
181        ":client_api",
182        ":client_server_testing",
183        "//pw_rpc:pw_rpc_test_pwpb_rpc",
184        "//pw_sync:mutex",
185    ],
186)
187
188pw_cc_test(
189    name = "client_server_context_threaded_test",
190    srcs = [
191        "client_server_context_threaded_test.cc",
192    ],
193    target_compatible_with = incompatible_with_mcu(),
194    deps = [
195        ":client_api",
196        ":client_server_testing_threaded",
197        "//pw_rpc:pw_rpc_test_pwpb_rpc",
198        "//pw_sync:binary_semaphore",
199        "//pw_sync:mutex",
200        "//pw_thread:non_portable_test_thread_options",
201        "//pw_thread_stl:non_portable_test_thread_options",
202    ],
203)
204
205pw_cc_test(
206    name = "codegen_test",
207    srcs = [
208        "codegen_test.cc",
209    ],
210    deps = [
211        ":internal_test_utils",
212        ":test_method_context",
213        "//pw_preprocessor",
214        "//pw_rpc:internal_test_utils",
215        "//pw_rpc:pw_rpc_test_pwpb_rpc",
216    ],
217)
218
219pw_cc_test(
220    name = "fake_channel_output_test",
221    srcs = ["fake_channel_output_test.cc"],
222    deps = [
223        ":common",
224        ":server_api",
225        ":test_method_context",
226        "//pw_rpc:internal_test_utils",
227        "//pw_rpc:pw_rpc_test_pwpb_rpc",
228    ],
229)
230
231pw_cc_test(
232    name = "method_test",
233    srcs = ["method_test.cc"],
234    deps = [
235        ":internal_test_utils",
236        ":server_api",
237        "//pw_containers:algorithm",
238        "//pw_rpc",
239        "//pw_rpc:internal_test_utils",
240        "//pw_rpc:pw_rpc_test_pwpb_rpc",
241    ],
242)
243
244pw_cc_test(
245    name = "method_info_test",
246    srcs = ["method_info_test.cc"],
247    deps = [
248        "//pw_rpc",
249        "//pw_rpc:internal_test_utils",
250        "//pw_rpc:pw_rpc_test_pwpb_rpc",
251    ],
252)
253
254pw_cc_test(
255    name = "method_lookup_test",
256    srcs = ["method_lookup_test.cc"],
257    deps = [
258        ":test_method_context",
259        "//pw_rpc:pw_rpc_test_pwpb_rpc",
260        "//pw_rpc/raw:test_method_context",
261    ],
262)
263
264pw_cc_test(
265    name = "method_union_test",
266    srcs = ["method_union_test.cc"],
267    deps = [
268        ":internal_test_utils",
269        ":server_api",
270        "//pw_rpc:internal_test_utils",
271        "//pw_rpc:pw_rpc_test_pwpb",
272    ],
273)
274
275pw_cc_test(
276    name = "echo_service_test",
277    srcs = ["echo_service_test.cc"],
278    deps = [
279        ":echo_service",
280        ":test_method_context",
281    ],
282)
283
284pw_cc_test(
285    name = "server_reader_writer_test",
286    srcs = ["server_reader_writer_test.cc"],
287    deps = [
288        ":server_api",
289        ":test_method_context",
290        "//pw_rpc",
291        "//pw_rpc:pw_rpc_test_pwpb_rpc",
292    ],
293)
294
295pw_cc_test(
296    name = "serde_test",
297    srcs = ["serde_test.cc"],
298    deps = [
299        ":common",
300        "//pw_rpc:pw_rpc_test_pwpb",
301    ],
302)
303
304pw_cc_test(
305    name = "server_callback_test",
306    srcs = ["server_callback_test.cc"],
307    deps = [
308        ":test_method_context",
309        "//pw_containers:vector",
310        "//pw_rpc",
311        "//pw_rpc:pw_rpc_test_pwpb_rpc",
312    ],
313)
314
315pw_cc_test(
316    name = "stub_generation_test",
317    srcs = ["stub_generation_test.cc"],
318    deps = [
319        "//pw_rpc:pw_rpc_test_pwpb_rpc",
320    ],
321)
322
323pw_cc_test(
324    name = "synchronous_call_test",
325    srcs = ["synchronous_call_test.cc"],
326    deps = [
327        ":test_method_context",
328        "//pw_rpc:pw_rpc_test_pwpb_rpc",
329        "//pw_rpc:synchronous_client_api",
330        "//pw_rpc_transport:test_loopback_service_registry",
331        "//pw_work_queue",
332        "//pw_work_queue:stl_test_thread",
333        "//pw_work_queue:test_thread_header",
334    ],
335)
336
337sphinx_docs_library(
338    name = "docs",
339    srcs = [
340        "docs.rst",
341    ],
342    target_compatible_with = incompatible_with_mcu(),
343)
344