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