| # Copyright 2022 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| |
| load( |
| "//pw_build:pigweed.bzl", |
| "pw_cc_library", |
| "pw_cc_test", |
| ) |
| load( |
| "//pw_build:selects.bzl", |
| "TARGET_COMPATIBLE_WITH_HOST_SELECT", |
| ) |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| licenses(["notice"]) |
| |
| pw_cc_library( |
| name = "server_api", |
| srcs = [ |
| "server_reader_writer.cc", |
| ], |
| hdrs = [ |
| "public/pw_rpc/pwpb/internal/method.h", |
| "public/pw_rpc/pwpb/internal/method_union.h", |
| "public/pw_rpc/pwpb/server_reader_writer.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| ":common", |
| "//pw_rpc/raw:server_api", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "client_api", |
| hdrs = [ |
| "public/pw_rpc/pwpb/client_reader_writer.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| ":common", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "common", |
| hdrs = [ |
| "public/pw_rpc/pwpb/internal/common.h", |
| "public/pw_rpc/pwpb/server_reader_writer.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| "//pw_rpc", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "test_method_context", |
| hdrs = [ |
| "public/pw_rpc/pwpb/fake_channel_output.h", |
| "public/pw_rpc/pwpb/test_method_context.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| ":common", |
| ":server_api", |
| "//pw_assert", |
| "//pw_containers", |
| "//pw_rpc:internal_test_utils", |
| "//pw_span", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "client_testing", |
| hdrs = [ |
| "public/pw_rpc/pwpb/client_testing.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| ":test_method_context", |
| "//pw_rpc", |
| "//pw_rpc/raw:client_testing", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "client_server_testing", |
| hdrs = [ |
| "public/pw_rpc/pwpb/client_server_testing.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| ":test_method_context", |
| "//pw_rpc:client_server_testing", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "client_server_testing_threaded", |
| hdrs = [ |
| "public/pw_rpc/pwpb/client_server_testing_threaded.h", |
| ], |
| includes = ["public"], |
| deps = [ |
| ":test_method_context", |
| "//pw_rpc:client_server_testing_threaded", |
| ], |
| ) |
| |
| pw_cc_library( |
| name = "internal_test_utils", |
| hdrs = ["pw_rpc_pwpb_private/internal_test_utils.h"], |
| deps = ["//pw_rpc:internal_test_utils"], |
| ) |
| |
| pw_cc_library( |
| name = "echo_service", |
| hdrs = ["public/pw_rpc/echo_service_pwpb.h"], |
| deps = [ |
| "//pw_rpc:echo_cc.pwpb_rpc", |
| ], |
| ) |
| |
| # TODO(b/242059613): Enable this library when logging_event_handler can be used. |
| filegroup( |
| name = "client_integration_test", |
| srcs = [ |
| "client_integration_test.cc", |
| ], |
| #deps = [ |
| # "//pw_rpc:integration_testing", |
| # "//pw_sync:binary_semaphore", |
| # "//pw_rpc:benchmark_cc.pwpb_rpc", |
| #] |
| ) |
| |
| pw_cc_test( |
| name = "client_call_test", |
| srcs = [ |
| "client_call_test.cc", |
| ], |
| deps = [ |
| ":client_api", |
| ":internal_test_utils", |
| "//pw_rpc", |
| "//pw_rpc:pw_rpc_test_cc.pwpb", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "client_reader_writer_test", |
| srcs = [ |
| "client_reader_writer_test.cc", |
| ], |
| deps = [ |
| ":client_api", |
| ":client_testing", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "client_server_context_test", |
| srcs = [ |
| "client_server_context_test.cc", |
| ], |
| deps = [ |
| ":client_api", |
| ":client_server_testing", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "client_server_context_threaded_test", |
| srcs = [ |
| "client_server_context_threaded_test.cc", |
| ], |
| target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT), |
| deps = [ |
| ":client_api", |
| ":client_server_testing_threaded", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| "//pw_sync:binary_semaphore", |
| "//pw_thread:test_threads_header", |
| "//pw_thread_stl:test_threads", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "codegen_test", |
| srcs = [ |
| "codegen_test.cc", |
| ], |
| deps = [ |
| ":internal_test_utils", |
| ":test_method_context", |
| "//pw_preprocessor", |
| "//pw_rpc:internal_test_utils", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "fake_channel_output_test", |
| srcs = ["fake_channel_output_test.cc"], |
| deps = [ |
| ":common", |
| ":server_api", |
| ":test_method_context", |
| "//pw_rpc:internal_test_utils", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "method_test", |
| srcs = ["method_test.cc"], |
| deps = [ |
| ":internal_test_utils", |
| ":server_api", |
| "//pw_containers", |
| "//pw_rpc", |
| "//pw_rpc:internal_test_utils", |
| "//pw_rpc:pw_rpc_test_cc.pwpb", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "method_info_test", |
| srcs = ["method_info_test.cc"], |
| deps = [ |
| "//pw_rpc", |
| "//pw_rpc:internal_test_utils", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "method_lookup_test", |
| srcs = ["method_lookup_test.cc"], |
| deps = [ |
| ":test_method_context", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| "//pw_rpc/raw:test_method_context", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "method_union_test", |
| srcs = ["method_union_test.cc"], |
| deps = [ |
| ":internal_test_utils", |
| ":server_api", |
| "//pw_rpc:internal_test_utils", |
| "//pw_rpc:pw_rpc_test_cc.pwpb", |
| ], |
| ) |
| |
| # TODO(b/234874064): Requires pwpb options file support to compile. |
| filegroup( |
| name = "echo_service_test", |
| srcs = ["echo_service_test.cc"], |
| # deps = [ |
| # ":echo_service", |
| # ":test_method_context", |
| # ], |
| ) |
| |
| pw_cc_test( |
| name = "server_reader_writer_test", |
| srcs = ["server_reader_writer_test.cc"], |
| deps = [ |
| ":server_api", |
| ":test_method_context", |
| "//pw_rpc", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "serde_test", |
| srcs = ["serde_test.cc"], |
| deps = [ |
| ":common", |
| "//pw_rpc:pw_rpc_test_cc.pwpb", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "server_callback_test", |
| srcs = ["server_callback_test.cc"], |
| deps = [ |
| ":test_method_context", |
| "//pw_rpc", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "stub_generation_test", |
| srcs = ["stub_generation_test.cc"], |
| deps = [ |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| ], |
| ) |
| |
| pw_cc_test( |
| name = "synchronous_call_test", |
| srcs = ["synchronous_call_test.cc"], |
| deps = [ |
| ":test_method_context", |
| "//pw_rpc:pw_rpc_test_cc.pwpb_rpc", |
| "//pw_rpc:synchronous_client_api", |
| "//pw_work_queue", |
| "//pw_work_queue:stl_test_thread", |
| "//pw_work_queue:test_thread_header", |
| ], |
| ) |