blob: 9a3478c20c10685f9131da85a47406809671171e [file] [log] [blame]
# 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.
# gn-format disable
import("//build_overrides/pigweed.gni")
import("$dir_pw_build/target_types.gni")
import("$dir_pw_docgen/docs.gni")
import("$dir_pw_protobuf_compiler/proto.gni")
import("$dir_pw_unit_test/test.gni")
config("default_config") {
include_dirs = [ "public" ]
visibility = [ ":*" ]
}
pw_source_set("server") {
public_configs = [ ":default_config" ]
public_deps = [
":protos_pwpb",
"$dir_pw_containers:intrusive_list",
dir_pw_assert,
dir_pw_span,
dir_pw_status,
]
deps = [ dir_pw_log ]
public = [
"public/pw_rpc/channel.h",
"public/pw_rpc/server.h",
"public/pw_rpc/server_context.h",
"public/pw_rpc/service.h",
]
sources = [
"base_server_writer.cc",
"channel.cc",
"packet.cc",
"public/pw_rpc/internal/base_server_writer.h",
"public/pw_rpc/internal/call.h",
"public/pw_rpc/internal/channel.h",
"public/pw_rpc/internal/hash.h",
"public/pw_rpc/internal/method.h",
"public/pw_rpc/internal/packet.h",
"public/pw_rpc/internal/server.h",
"server.cc",
"service.cc",
]
friend = [ "./*" ]
}
pw_source_set("test_utils") {
public = [
"public/pw_rpc/internal/test_method.h",
"pw_rpc_private/internal_test_utils.h",
]
public_configs = [ ":private_includes" ]
public_deps = [
":server",
dir_pw_span,
]
visibility = [ "./*" ]
}
# Provides the public RPC service definition (but not implementation). Can be
# used to expose global service registration without depending on the complete
# RPC library.
# TODO(hepler): Remove this unnecessary alias.
group("service") {
deps = [ ":server" ]
}
# RPC server that uses Nanopb to encode and decode protobufs. RPCs use Nanopb
# structs as their requests and responses.
# TODO(hepler): Remove this unnecessary alias.
group("nanopb_server") {
deps = [ ":server" ]
}
config("private_includes") {
include_dirs = [ "." ]
visibility = [ ":*" ]
}
pw_proto_library("protos") {
sources = [ "pw_rpc_protos/packet.proto" ]
}
pw_proto_library("echo_service_proto") {
sources = [ "pw_rpc_protos/echo.proto" ]
inputs = [ "pw_rpc_protos/echo.options" ]
}
# Source files for pw_protobuf's protoc plugin.
pw_input_group("nanopb_protoc_plugin") {
inputs = [
"py/pw_rpc/codegen_nanopb.py",
"py/pw_rpc/plugin.py",
"py/pw_rpc/ids.py",
]
deps = [ "$dir_pw_protobuf:codegen_protoc_lib" ]
}
pw_doc_group("docs") {
sources = [ "docs.rst" ]
inputs = [
"pw_rpc_protos/echo.proto",
"pw_rpc_protos/packet.proto",
]
group_deps = [ "nanopb:docs" ]
}
pw_test_group("tests") {
tests = [
":base_server_writer_test",
":channel_test",
":packet_test",
":server_test",
":service_test",
]
group_deps = [ "nanopb:tests" ]
}
pw_proto_library("test_protos") {
sources = [ "pw_rpc_test_protos/test.proto" ]
visibility = [ "./*" ]
}
pw_test("base_server_writer_test") {
deps = [
":server",
":test_utils",
]
sources = [ "base_server_writer_test.cc" ]
}
pw_test("channel_test") {
deps = [
":server",
":test_utils",
]
sources = [ "channel_test.cc" ]
}
pw_test("hash_test") {
deps = [ ":server" ]
sources = [ "hash_test.cc" ]
}
pw_test("packet_test") {
deps = [
":server",
dir_pw_bytes,
dir_pw_protobuf,
]
sources = [ "packet_test.cc" ]
}
pw_test("service_test") {
deps = [
":protos_pwpb",
":server",
dir_pw_assert,
]
sources = [ "service_test.cc" ]
}
pw_test("server_test") {
deps = [
":protos_pwpb",
":server",
":test_utils",
dir_pw_assert,
]
sources = [ "server_test.cc" ]
}