blob: 6ff5dd56172bd534dd4bd8333aa15d8249473cbc [file] [log] [blame]
# Copyright 2023 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("@rules_proto//proto:defs.bzl", "proto_library")
load("//pw_build:pigweed.bzl", "pw_cc_test")
load(
"//pw_build:selects.bzl",
"TARGET_COMPATIBLE_WITH_HOST_SELECT",
)
load(
"//pw_protobuf_compiler:pw_proto_library.bzl",
"pw_proto_filegroup",
"pwpb_proto_library",
"pwpb_rpc_proto_library",
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
cc_library(
name = "rpc_transport",
hdrs = ["public/pw_rpc_transport/rpc_transport.h"],
includes = ["public"],
deps = [
"//pw_bytes",
"//pw_function",
"//pw_status",
],
)
cc_library(
name = "service_registry",
hdrs = ["public/pw_rpc_transport/service_registry.h"],
includes = ["public"],
deps = [
":rpc_transport",
"//pw_rpc:client_server",
"//pw_span",
"//pw_status",
],
)
cc_library(
name = "test_loopback_service_registry",
hdrs = ["public/pw_rpc_transport/test_loopback_service_registry.h"],
includes = ["public"],
deps = [
":egress_ingress",
":service_registry",
"//pw_work_queue",
"//pw_work_queue:test_thread_header",
],
)
cc_library(
name = "packet_buffer_queue",
hdrs = ["public/pw_rpc_transport/internal/packet_buffer_queue.h"],
includes = ["public"],
deps = [
"//pw_assert",
"//pw_bytes",
"//pw_containers",
"//pw_log",
"//pw_result",
"//pw_status",
"//pw_sync:lock_annotations",
"//pw_sync:mutex",
],
)
pw_cc_test(
name = "packet_buffer_queue_test",
srcs = [
"internal/packet_buffer_queue_test.cc",
],
deps = [
":packet_buffer_queue",
"//pw_bytes",
"//pw_containers",
"//pw_result",
"//pw_status",
"//pw_sync:lock_annotations",
"//pw_sync:mutex",
],
)
cc_library(
name = "local_rpc_egress",
srcs = ["local_rpc_egress.cc"],
hdrs = ["public/pw_rpc_transport/local_rpc_egress.h"],
includes = ["public"],
deps = [
":packet_buffer_queue",
":rpc_transport",
":test_protos_pwpb_rpc",
"//pw_bytes",
"//pw_log",
"//pw_result",
"//pw_rpc:client_server",
"//pw_status",
"//pw_sync:thread_notification",
"//pw_thread:thread_core",
],
)
pw_cc_test(
name = "local_rpc_egress_test",
srcs = [
"local_rpc_egress_test.cc",
],
deps = [
":local_rpc_egress",
":rpc_transport",
":service_registry",
":test_protos_pwpb_rpc",
"//pw_bytes",
"//pw_chrono:system_clock",
"//pw_rpc:client_server",
"//pw_status",
"//pw_sync:counting_semaphore",
"//pw_sync:thread_notification",
"//pw_thread:sleep",
"//pw_thread:thread",
],
)
cc_library(
name = "hdlc_framing",
hdrs = [
"public/pw_rpc_transport/hdlc_framing.h",
],
deps = [
":rpc_transport",
"//pw_bytes",
"//pw_hdlc",
"//pw_hdlc:default_addresses",
"//pw_result",
"//pw_status",
"//pw_stream",
],
)
pw_cc_test(
name = "hdlc_framing_test",
srcs = [
"hdlc_framing_test.cc",
],
deps = [
":hdlc_framing",
"//pw_bytes",
"//pw_status",
],
)
cc_library(
name = "simple_framing",
srcs = [
"simple_framing.cc",
],
hdrs = ["public/pw_rpc_transport/simple_framing.h"],
deps = [
":rpc_transport",
"//pw_assert",
"//pw_bytes",
"//pw_log",
"//pw_status",
],
)
pw_cc_test(
name = "simple_framing_test",
srcs = ["simple_framing_test.cc"],
deps = [
":simple_framing",
"//pw_bytes",
"//pw_log",
"//pw_status",
],
)
cc_library(
name = "egress_ingress",
srcs = [
"egress_ingress.cc",
],
hdrs = ["public/pw_rpc_transport/egress_ingress.h"],
deps = [
":hdlc_framing",
":rpc_transport",
":simple_framing",
"//pw_bytes",
"//pw_log",
"//pw_metric:metric",
"//pw_rpc:client_server",
"//pw_status",
"//pw_sync:mutex",
],
)
pw_cc_test(
name = "egress_ingress_test",
srcs = ["egress_ingress_test.cc"],
deps = [
":egress_ingress",
":service_registry",
":test_protos_pwpb_rpc",
"//pw_bytes",
"//pw_metric:metric",
"//pw_status",
"//pw_sync:thread_notification",
],
)
cc_library(
name = "socket_rpc_transport",
srcs = ["socket_rpc_transport.cc"],
hdrs = ["public/pw_rpc_transport/socket_rpc_transport.h"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":rpc_transport",
"//pw_assert",
"//pw_chrono:system_clock",
"//pw_log",
"//pw_status",
"//pw_stream",
"//pw_stream:socket_stream",
"//pw_sync:lock_annotations",
"//pw_sync:mutex",
"//pw_sync:thread_notification",
"//pw_sync_stl:condition_variable",
"//pw_thread:sleep",
"//pw_thread:thread_core",
],
)
cc_library(
name = "stream_rpc_frame_sender",
hdrs = ["public/pw_rpc_transport/stream_rpc_frame_sender.h"],
deps = [
":rpc_transport",
"//pw_status",
"//pw_stream",
],
)
cc_library(
name = "stream_rpc_dispatcher",
hdrs = ["public/pw_rpc_transport/stream_rpc_dispatcher.h"],
deps = [
":egress_ingress",
"//pw_metric:metric",
"//pw_status",
"//pw_stream",
],
)
pw_cc_test(
name = "socket_rpc_transport_test",
srcs = ["socket_rpc_transport_test.cc"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":socket_rpc_transport",
"//pw_bytes",
"//pw_log",
"//pw_status",
"//pw_sync:mutex",
"//pw_sync:thread_notification",
"//pw_thread:sleep",
"//pw_thread:thread",
],
)
pw_cc_test(
name = "stream_rpc_dispatcher_test",
srcs = ["stream_rpc_dispatcher_test.cc"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":stream_rpc_dispatcher",
"//pw_bytes",
"//pw_log",
"//pw_status",
"//pw_sync:thread_notification",
"//pw_thread:thread",
],
)
pw_cc_test(
name = "rpc_integration_test",
srcs = ["rpc_integration_test.cc"],
target_compatible_with = select(TARGET_COMPATIBLE_WITH_HOST_SELECT),
deps = [
":egress_ingress",
":local_rpc_egress",
":service_registry",
":socket_rpc_transport",
":test_protos_pwpb_rpc",
"//pw_chrono:system_clock",
"//pw_log",
"//pw_rpc:client_server",
"//pw_rpc:synchronous_client_api",
"//pw_string",
"//pw_thread:thread",
],
)
pw_proto_filegroup(
name = "test_protos_and_options",
srcs = ["internal/test.proto"],
options_files = ["internal/test.options"],
)
proto_library(
name = "test_protos",
srcs = [":test_protos_and_options"],
)
pwpb_proto_library(
name = "test_protos_pwpb",
deps = [":test_protos"],
)
pwpb_rpc_proto_library(
name = "test_protos_pwpb_rpc",
pwpb_proto_library_deps = [":test_protos_pwpb"],
deps = [":test_protos"],
)