1# Copyright 2020 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( 16 "//pw_build:pigweed.bzl", 17 "pw_cc_library", 18 "pw_cc_test", 19) 20 21package(default_visibility = ["//visibility:public"]) 22 23licenses(["notice"]) # Apache License 2.0 24 25pw_cc_library( 26 name = "client", 27 srcs = [ 28 "base_client_call.cc", 29 "client.cc", 30 ], 31 hdrs = [ 32 "public/pw_rpc/client.h", 33 "public/pw_rpc/internal/base_client_call.h", 34 ], 35 deps = [ 36 ":common", 37 ], 38) 39 40pw_cc_library( 41 name = "server", 42 srcs = [ 43 "base_server_writer.cc", 44 "public/pw_rpc/internal/base_server_writer.h", 45 "public/pw_rpc/internal/call.h", 46 "public/pw_rpc/internal/hash.h", 47 "public/pw_rpc/internal/method.h", 48 "public/pw_rpc/internal/method_lookup.h", 49 "public/pw_rpc/internal/method_union.h", 50 "public/pw_rpc/internal/server.h", 51 "server.cc", 52 "service.cc", 53 ], 54 hdrs = [ 55 "public/pw_rpc/server.h", 56 "public/pw_rpc/server_context.h", 57 "public/pw_rpc/service.h", 58 ], 59 includes = ["public"], 60 deps = [ 61 ":common", 62 ], 63) 64 65pw_cc_library( 66 name = "client_server", 67 srcs = ["client_server.cc"], 68 hdrs = ["public/pw_rpc/client_server.h"], 69 deps = [ 70 ":client", 71 ":server", 72 ], 73) 74 75pw_cc_library( 76 name = "common", 77 srcs = [ 78 "channel.cc", 79 "packet.cc", 80 "public/pw_rpc/internal/channel.h", 81 "public/pw_rpc/internal/config.h", 82 "public/pw_rpc/internal/method_type.h", 83 "public/pw_rpc/internal/packet.h", 84 ], 85 hdrs = [ 86 "public/pw_rpc/channel.h", 87 ], 88 includes = ["public"], 89 deps = [ 90 "//pw_assert", 91 "//pw_log", 92 "//pw_span", 93 "//pw_status", 94 ], 95) 96 97pw_cc_library( 98 name = "synchronized_channel_output", 99 hdrs = ["public/pw_rpc/synchronized_channel_output.h"], 100 includes = ["public"], 101 deps = [ 102 ":common", 103 "//pw_sync:lock_annotations", 104 "//pw_sync:mutex", 105 ], 106) 107 108pw_cc_library( 109 name = "internal_test_utils", 110 hdrs = [ 111 "public/pw_rpc/internal/test_method.h", 112 "pw_rpc_private/internal_test_utils.h", 113 "pw_rpc_private/method_impl_tester.h", 114 ], 115 visibility = ["//visibility:private"], 116 deps = [ 117 ":server", 118 "//pw_span", 119 ], 120) 121 122# TODO(hepler): Cannot build nanopb-dependent code in Bazel at the moment. Need 123# to determine how best to support Nanopb builds and protobuf generation. 124filegroup( 125 name = "nanopb", 126 srcs = [ 127 "nanopb/codegen_test.cc", 128 "nanopb/echo_service_test.cc", 129 "nanopb/method_lookup_test.cc", 130 "nanopb/nanopb_client_call.cc", 131 "nanopb/nanopb_client_call_test.cc", 132 "nanopb/nanopb_common.cc", 133 "nanopb/nanopb_method.cc", 134 "nanopb/nanopb_method_test.cc", 135 "nanopb/nanopb_method_union_test.cc", 136 "nanopb/public/pw_rpc/echo_service_nanopb.h", 137 "nanopb/public/pw_rpc/internal/nanopb_common.h", 138 "nanopb/public/pw_rpc/internal/nanopb_method.h", 139 "nanopb/public/pw_rpc/internal/nanopb_method_union.h", 140 "nanopb/public/pw_rpc/nanopb_client_call.h", 141 "nanopb/public/pw_rpc/nanopb_test_method_context.h", 142 "nanopb/pw_rpc_nanopb_private/internal_test_utils.h", 143 "nanopb/stub_generation_test.cc", 144 ], 145) 146 147pw_cc_test( 148 name = "base_server_writer_test", 149 srcs = [ 150 "base_server_writer_test.cc", 151 ], 152 deps = [ 153 ":internal_test_utils", 154 ":server", 155 ], 156) 157 158pw_cc_test( 159 name = "base_client_call_test", 160 srcs = [ 161 "base_client_call_test.cc", 162 ], 163 deps = [ 164 ":client", 165 ":internal_test_utils", 166 ], 167) 168 169pw_cc_test( 170 name = "client_test", 171 srcs = [ 172 "client_test.cc", 173 ], 174 deps = [ 175 ":client", 176 ":internal_test_utils", 177 ], 178) 179 180pw_cc_test( 181 name = "channel_test", 182 srcs = ["channel_test.cc"], 183 deps = [ 184 ":server", 185 ":test_utils_test_server", 186 ], 187) 188 189pw_cc_test( 190 name = "packet_test", 191 srcs = [ 192 "packet_test.cc", 193 ], 194 deps = [ 195 ":server", 196 ], 197) 198 199pw_cc_test( 200 name = "client_server_test", 201 srcs = ["client_server_test.cc"], 202 deps = [ 203 ":client_server", 204 "//pw_rpc/raw:method_union", 205 ], 206) 207 208proto_library( 209 name = "packet_proto", 210 srcs = [ 211 "pw_rpc_protos/internal/packet.proto", 212 ], 213) 214 215pw_cc_test( 216 name = "server_test", 217 srcs = [ 218 "server_test.cc", 219 ], 220 deps = [ 221 ":internal_test_utils", 222 ":server", 223 "//pw_assert", 224 ], 225) 226 227pw_cc_test( 228 name = "service_test", 229 srcs = [ 230 "service_test.cc", 231 ], 232 deps = [ 233 ":internal_test_utils", 234 ":server", 235 "//pw_assert", 236 ], 237) 238