2020-05-05 00:06:17 +00:00
|
|
|
# Copyright 2020 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.
|
|
|
|
|
2021-05-06 06:49:55 +00:00
|
|
|
load("@rules_proto//proto:defs.bzl", "proto_library")
|
2020-05-05 00:06:17 +00:00
|
|
|
load(
|
|
|
|
"//pw_build:pigweed.bzl",
|
|
|
|
"pw_cc_library",
|
|
|
|
"pw_cc_test",
|
|
|
|
)
|
2021-05-06 06:49:55 +00:00
|
|
|
load("@rules_proto_grpc//:plugin.bzl", "proto_plugin")
|
|
|
|
load("//pw_protobuf_compiler:proto.bzl", "pw_proto_library")
|
2020-05-05 00:06:17 +00:00
|
|
|
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
|
2021-07-26 18:12:22 +00:00
|
|
|
licenses(["notice"])
|
2020-05-05 00:06:17 +00:00
|
|
|
|
2020-08-04 17:19:24 +00:00
|
|
|
pw_cc_library(
|
|
|
|
name = "client",
|
|
|
|
srcs = [
|
|
|
|
"base_client_call.cc",
|
2020-11-23 15:49:47 +00:00
|
|
|
"client.cc",
|
2020-08-04 17:19:24 +00:00
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"public/pw_rpc/client.h",
|
|
|
|
"public/pw_rpc/internal/base_client_call.h",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":common",
|
2021-05-06 06:49:55 +00:00
|
|
|
"//pw_containers:intrusive_list",
|
2020-11-23 15:49:47 +00:00
|
|
|
],
|
2020-08-04 17:19:24 +00:00
|
|
|
)
|
|
|
|
|
2020-05-05 00:06:17 +00:00
|
|
|
pw_cc_library(
|
2020-09-15 18:17:24 +00:00
|
|
|
name = "server",
|
2020-06-01 16:30:17 +00:00
|
|
|
srcs = [
|
2020-09-15 18:17:24 +00:00
|
|
|
"public/pw_rpc/internal/call.h",
|
|
|
|
"public/pw_rpc/internal/hash.h",
|
|
|
|
"public/pw_rpc/internal/method.h",
|
2020-11-23 15:58:59 +00:00
|
|
|
"public/pw_rpc/internal/method_lookup.h",
|
2020-10-14 19:43:14 +00:00
|
|
|
"public/pw_rpc/internal/method_union.h",
|
2021-06-18 19:56:17 +00:00
|
|
|
"public/pw_rpc/internal/responder.h",
|
2020-09-15 18:17:24 +00:00
|
|
|
"public/pw_rpc/internal/server.h",
|
2021-06-18 19:56:17 +00:00
|
|
|
"responder.cc",
|
2020-06-01 16:30:17 +00:00
|
|
|
"server.cc",
|
|
|
|
"service.cc",
|
|
|
|
],
|
2020-05-05 00:06:17 +00:00
|
|
|
hdrs = [
|
|
|
|
"public/pw_rpc/server.h",
|
2020-06-01 16:30:17 +00:00
|
|
|
"public/pw_rpc/server_context.h",
|
2020-08-04 17:33:26 +00:00
|
|
|
"public/pw_rpc/service.h",
|
2020-06-01 16:30:17 +00:00
|
|
|
],
|
|
|
|
includes = ["public"],
|
2020-08-04 17:19:24 +00:00
|
|
|
deps = [
|
|
|
|
":common",
|
2021-05-06 06:49:55 +00:00
|
|
|
":internal_packet_pwpb",
|
|
|
|
"//pw_containers",
|
2020-08-04 17:19:24 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2021-04-12 21:53:06 +00:00
|
|
|
pw_cc_library(
|
|
|
|
name = "client_server",
|
|
|
|
srcs = ["client_server.cc"],
|
|
|
|
hdrs = ["public/pw_rpc/client_server.h"],
|
|
|
|
deps = [
|
|
|
|
":client",
|
|
|
|
":server",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-08-04 17:19:24 +00:00
|
|
|
pw_cc_library(
|
|
|
|
name = "common",
|
|
|
|
srcs = [
|
|
|
|
"channel.cc",
|
|
|
|
"packet.cc",
|
|
|
|
"public/pw_rpc/internal/channel.h",
|
2020-11-25 18:53:25 +00:00
|
|
|
"public/pw_rpc/internal/config.h",
|
2020-08-04 17:19:24 +00:00
|
|
|
"public/pw_rpc/internal/method_type.h",
|
|
|
|
"public/pw_rpc/internal/packet.h",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"public/pw_rpc/channel.h",
|
|
|
|
],
|
|
|
|
includes = ["public"],
|
2020-06-01 16:30:17 +00:00
|
|
|
deps = [
|
2021-05-06 06:49:55 +00:00
|
|
|
":internal_packet_pwpb",
|
2020-06-01 16:30:17 +00:00
|
|
|
"//pw_assert",
|
2021-05-06 06:49:55 +00:00
|
|
|
"//pw_bytes",
|
2021-06-11 01:15:59 +00:00
|
|
|
"//pw_function",
|
2020-06-01 16:30:17 +00:00
|
|
|
"//pw_log",
|
|
|
|
"//pw_span",
|
|
|
|
"//pw_status",
|
2020-05-05 00:06:17 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-12-30 22:55:09 +00:00
|
|
|
pw_cc_library(
|
|
|
|
name = "synchronized_channel_output",
|
|
|
|
hdrs = ["public/pw_rpc/synchronized_channel_output.h"],
|
|
|
|
includes = ["public"],
|
|
|
|
deps = [
|
|
|
|
":common",
|
2021-04-08 15:51:16 +00:00
|
|
|
"//pw_sync:lock_annotations",
|
2020-12-30 22:55:09 +00:00
|
|
|
"//pw_sync:mutex",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-06-01 18:25:58 +00:00
|
|
|
pw_cc_library(
|
2020-07-17 15:54:37 +00:00
|
|
|
name = "internal_test_utils",
|
2021-06-18 19:56:17 +00:00
|
|
|
srcs = ["fake_channel_output.cc"],
|
2020-09-15 18:17:24 +00:00
|
|
|
hdrs = [
|
|
|
|
"public/pw_rpc/internal/test_method.h",
|
2021-07-02 07:54:13 +00:00
|
|
|
"public/pw_rpc/internal/test_method_context.h",
|
2021-06-18 19:56:17 +00:00
|
|
|
"pw_rpc_private/fake_channel_output.h",
|
2021-06-11 01:15:59 +00:00
|
|
|
"pw_rpc_private/fake_server_reader_writer.h",
|
2020-09-15 18:17:24 +00:00
|
|
|
"pw_rpc_private/internal_test_utils.h",
|
2020-11-23 15:50:59 +00:00
|
|
|
"pw_rpc_private/method_impl_tester.h",
|
2020-09-15 18:17:24 +00:00
|
|
|
],
|
2021-05-06 06:49:55 +00:00
|
|
|
includes = [
|
|
|
|
".",
|
|
|
|
"public",
|
|
|
|
],
|
|
|
|
visibility = [":__subpackages__"],
|
2020-06-01 18:25:58 +00:00
|
|
|
deps = [
|
2021-05-06 06:49:55 +00:00
|
|
|
":client",
|
2020-09-15 18:17:24 +00:00
|
|
|
":server",
|
2021-06-18 19:56:17 +00:00
|
|
|
"//pw_assert",
|
|
|
|
"//pw_bytes",
|
2020-06-01 18:25:58 +00:00
|
|
|
"//pw_span",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-06-02 23:52:28 +00:00
|
|
|
# TODO(hepler): Cannot build nanopb-dependent code in Bazel at the moment. Need
|
|
|
|
# to determine how best to support Nanopb builds and protobuf generation.
|
|
|
|
filegroup(
|
|
|
|
name = "nanopb",
|
|
|
|
srcs = [
|
2021-07-10 00:18:41 +00:00
|
|
|
"nanopb/client_call.cc",
|
|
|
|
"nanopb/client_call_test.cc",
|
2020-07-10 00:05:52 +00:00
|
|
|
"nanopb/codegen_test.cc",
|
2021-07-10 00:18:41 +00:00
|
|
|
"nanopb/common.cc",
|
2020-07-16 22:36:02 +00:00
|
|
|
"nanopb/echo_service_test.cc",
|
2021-07-10 00:18:41 +00:00
|
|
|
"nanopb/method.cc",
|
2020-11-23 15:58:59 +00:00
|
|
|
"nanopb/method_lookup_test.cc",
|
2021-07-10 00:18:41 +00:00
|
|
|
"nanopb/method_test.cc",
|
|
|
|
"nanopb/method_union_test.cc",
|
2020-07-16 22:36:02 +00:00
|
|
|
"nanopb/public/pw_rpc/echo_service_nanopb.h",
|
2021-07-10 00:18:41 +00:00
|
|
|
"nanopb/public/pw_rpc/nanopb/client_call.h",
|
|
|
|
"nanopb/public/pw_rpc/nanopb/internal/common.h",
|
|
|
|
"nanopb/public/pw_rpc/nanopb/internal/method.h",
|
|
|
|
"nanopb/public/pw_rpc/nanopb/internal/method_union.h",
|
2021-06-15 23:23:44 +00:00
|
|
|
"nanopb/public/pw_rpc/nanopb/server_reader_writer.h",
|
2021-07-10 00:18:41 +00:00
|
|
|
"nanopb/public/pw_rpc/nanopb/test_method_context.h",
|
2020-10-20 20:51:24 +00:00
|
|
|
"nanopb/public/pw_rpc/nanopb_test_method_context.h",
|
2020-08-04 17:19:24 +00:00
|
|
|
"nanopb/pw_rpc_nanopb_private/internal_test_utils.h",
|
2021-06-15 23:23:44 +00:00
|
|
|
"nanopb/server_reader_writer.cc",
|
2020-11-25 15:25:16 +00:00
|
|
|
"nanopb/stub_generation_test.cc",
|
2020-06-02 23:52:28 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-06-01 18:25:58 +00:00
|
|
|
pw_cc_test(
|
2021-06-18 22:14:26 +00:00
|
|
|
name = "responder_test",
|
2020-06-01 18:25:58 +00:00
|
|
|
srcs = [
|
2021-06-16 02:44:32 +00:00
|
|
|
"responder_test.cc",
|
2020-06-01 18:25:58 +00:00
|
|
|
],
|
|
|
|
deps = [
|
2020-07-17 15:54:37 +00:00
|
|
|
":internal_test_utils",
|
2020-09-15 18:17:24 +00:00
|
|
|
":server",
|
2020-06-01 18:25:58 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-08-04 17:19:24 +00:00
|
|
|
pw_cc_test(
|
|
|
|
name = "base_client_call_test",
|
|
|
|
srcs = [
|
|
|
|
"base_client_call_test.cc",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":client",
|
|
|
|
":internal_test_utils",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
pw_cc_test(
|
|
|
|
name = "client_test",
|
|
|
|
srcs = [
|
|
|
|
"client_test.cc",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":client",
|
|
|
|
":internal_test_utils",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-06-09 21:39:33 +00:00
|
|
|
pw_cc_test(
|
|
|
|
name = "channel_test",
|
|
|
|
srcs = ["channel_test.cc"],
|
|
|
|
deps = [
|
2021-05-06 06:49:55 +00:00
|
|
|
":internal_test_utils",
|
2020-09-15 18:17:24 +00:00
|
|
|
":server",
|
2020-06-09 21:39:33 +00:00
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-05-05 00:06:17 +00:00
|
|
|
pw_cc_test(
|
2020-06-01 16:30:17 +00:00
|
|
|
name = "packet_test",
|
2020-05-05 00:06:17 +00:00
|
|
|
srcs = [
|
2020-06-01 16:30:17 +00:00
|
|
|
"packet_test.cc",
|
2020-05-05 00:06:17 +00:00
|
|
|
],
|
|
|
|
deps = [
|
2020-09-15 18:17:24 +00:00
|
|
|
":server",
|
2020-05-05 00:06:17 +00:00
|
|
|
],
|
|
|
|
)
|
2020-05-08 20:57:02 +00:00
|
|
|
|
2021-04-12 21:53:06 +00:00
|
|
|
pw_cc_test(
|
|
|
|
name = "client_server_test",
|
|
|
|
srcs = ["client_server_test.cc"],
|
|
|
|
deps = [
|
|
|
|
":client_server",
|
2021-05-06 06:49:55 +00:00
|
|
|
":internal_test_utils",
|
2021-04-12 21:53:06 +00:00
|
|
|
"//pw_rpc/raw:method_union",
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-06-03 18:03:05 +00:00
|
|
|
proto_library(
|
|
|
|
name = "packet_proto",
|
|
|
|
srcs = [
|
2021-05-06 06:49:55 +00:00
|
|
|
"internal/packet.proto",
|
2020-06-02 23:52:28 +00:00
|
|
|
],
|
2020-06-03 18:03:05 +00:00
|
|
|
)
|
|
|
|
|
2020-05-08 20:57:02 +00:00
|
|
|
pw_cc_test(
|
2020-06-01 16:30:17 +00:00
|
|
|
name = "server_test",
|
2020-05-08 20:57:02 +00:00
|
|
|
srcs = [
|
2020-06-01 16:30:17 +00:00
|
|
|
"server_test.cc",
|
2020-05-08 20:57:02 +00:00
|
|
|
],
|
|
|
|
deps = [
|
2020-07-17 15:54:37 +00:00
|
|
|
":internal_test_utils",
|
2020-09-15 18:17:24 +00:00
|
|
|
":server",
|
2020-06-01 16:30:17 +00:00
|
|
|
"//pw_assert",
|
2020-05-08 20:57:02 +00:00
|
|
|
],
|
|
|
|
)
|
2020-09-15 17:04:41 +00:00
|
|
|
|
|
|
|
pw_cc_test(
|
|
|
|
name = "service_test",
|
|
|
|
srcs = [
|
|
|
|
"service_test.cc",
|
|
|
|
],
|
|
|
|
deps = [
|
|
|
|
":internal_test_utils",
|
2020-09-15 18:17:24 +00:00
|
|
|
":server",
|
2020-09-15 17:04:41 +00:00
|
|
|
"//pw_assert",
|
|
|
|
],
|
|
|
|
)
|
2021-05-06 06:49:55 +00:00
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "internal_packet_proto",
|
|
|
|
srcs = ["internal/packet.proto"],
|
|
|
|
visibility = ["//visibility:private"],
|
|
|
|
)
|
|
|
|
|
|
|
|
pw_proto_library(
|
|
|
|
name = "internal_packet_pwpb",
|
|
|
|
deps = [":internal_packet_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
proto_library(
|
|
|
|
name = "pw_rpc_test_proto",
|
|
|
|
srcs = ["pw_rpc_test_protos/test.proto"],
|
|
|
|
strip_import_prefix = "//pw_rpc",
|
|
|
|
)
|
|
|
|
|
|
|
|
pw_proto_library(
|
|
|
|
name = "pw_rpc_test_pwpb",
|
|
|
|
deps = [":pw_rpc_test_proto"],
|
|
|
|
)
|
|
|
|
|
|
|
|
proto_plugin(
|
|
|
|
name = "pw_cc_plugin",
|
|
|
|
outputs = [
|
|
|
|
"{protopath}.raw_rpc.pb.h",
|
|
|
|
],
|
|
|
|
protoc_plugin_name = "raw_rpc",
|
|
|
|
tool = "@pigweed//pw_rpc/py:plugin",
|
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
)
|