Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 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 | |
| 15 | load( |
| 16 | "//pw_build:pigweed.bzl", |
| 17 | "pw_cc_library", |
| 18 | "pw_cc_test", |
| 19 | ) |
| 20 | |
| 21 | package(default_visibility = ["//visibility:public"]) |
| 22 | |
| 23 | licenses(["notice"]) # Apache License 2.0 |
| 24 | |
| 25 | pw_cc_library( |
| 26 | name = "pw_rpc", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 27 | srcs = [ |
Wyatt Hepler | cb9d957 | 2020-06-01 11:25:58 -0700 | [diff] [blame] | 28 | "base_server_writer.cc", |
| 29 | "public/pw_rpc/internal/base_server_writer.h", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 30 | "public/pw_rpc/internal/service.h", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 31 | "server.cc", |
| 32 | "service.cc", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 33 | ], |
| 34 | hdrs = [ |
| 35 | "public/pw_rpc/server.h", |
| 36 | "public/pw_rpc/server_context.h", |
Wyatt Hepler | 671946e | 2020-06-09 14:39:33 -0700 | [diff] [blame^] | 37 | "public/pw_rpc/internal/channel.h", |
| 38 | "public/pw_rpc/internal/server.h", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 39 | # TODO(hepler): Only building the test version of the server for now. |
Wyatt Hepler | 948f547 | 2020-06-02 16:52:28 -0700 | [diff] [blame] | 40 | "test_impl/public_overrides/pw_rpc/internal/method.h", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 41 | ], |
| 42 | includes = [ |
| 43 | "public", |
Wyatt Hepler | 948f547 | 2020-06-02 16:52:28 -0700 | [diff] [blame] | 44 | "test_impl/public_overrides/", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 45 | ], |
| 46 | deps = [ |
| 47 | ":common", |
| 48 | "//pw_assert", |
| 49 | "//pw_log", |
| 50 | "//pw_span", |
| 51 | "//pw_status", |
| 52 | ], |
| 53 | ) |
| 54 | |
| 55 | pw_cc_library( |
| 56 | name = "common", |
| 57 | srcs = [ |
| 58 | "channel.cc", |
| 59 | "packet.cc", |
| 60 | ], |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 61 | hdrs = [ |
| 62 | "public/pw_rpc/channel.h", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 63 | "public/pw_rpc/internal/base_method.h", |
Wyatt Hepler | 7da973a | 2020-06-09 10:04:48 -0700 | [diff] [blame] | 64 | "public/pw_rpc/internal/call.h", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 65 | "public/pw_rpc/internal/packet.h", |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 66 | "public/pw_rpc/server.h", |
| 67 | ], |
| 68 | includes = ["public"], |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 69 | visibility = ["//visibility:private"], |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 70 | deps = [ |
| 71 | "//pw_assert", |
Alexei Frolov | 5d6d392 | 2020-05-08 13:57:02 -0700 | [diff] [blame] | 72 | "//pw_log", |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 73 | "//pw_span", |
Alexei Frolov | 5d6d392 | 2020-05-08 13:57:02 -0700 | [diff] [blame] | 74 | "//pw_status", |
| 75 | ], |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 76 | ) |
| 77 | |
Wyatt Hepler | cb9d957 | 2020-06-01 11:25:58 -0700 | [diff] [blame] | 78 | pw_cc_library( |
| 79 | name = "test_utils", |
| 80 | hdrs = ["pw_rpc_private/test_utils.h"], |
| 81 | visibility = ["//visibility:private"], |
| 82 | deps = [ |
| 83 | ":common", |
| 84 | "//pw_span", |
| 85 | ], |
| 86 | ) |
| 87 | |
Wyatt Hepler | 948f547 | 2020-06-02 16:52:28 -0700 | [diff] [blame] | 88 | # TODO(hepler): Cannot build nanopb-dependent code in Bazel at the moment. Need |
| 89 | # to determine how best to support Nanopb builds and protobuf generation. |
| 90 | filegroup( |
| 91 | name = "nanopb", |
| 92 | srcs = [ |
| 93 | "nanopb/method.cc", |
| 94 | "nanopb/method_test.cc", |
| 95 | "nanopb/public_overrides/pw_rpc/internal/method.h", |
| 96 | ], |
| 97 | ) |
| 98 | |
Wyatt Hepler | cb9d957 | 2020-06-01 11:25:58 -0700 | [diff] [blame] | 99 | pw_cc_test( |
| 100 | name = "base_server_writer_test", |
| 101 | srcs = [ |
| 102 | "base_server_writer_test.cc", |
| 103 | ], |
| 104 | deps = [ |
| 105 | ":pw_rpc", |
| 106 | ":test_utils", |
| 107 | ], |
| 108 | ) |
| 109 | |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 110 | pw_cc_test( |
Wyatt Hepler | 671946e | 2020-06-09 14:39:33 -0700 | [diff] [blame^] | 111 | name = "channel_test", |
| 112 | srcs = ["channel_test.cc"], |
| 113 | deps = [ |
| 114 | ":common", |
| 115 | ":test_utils_test_server", |
| 116 | ], |
| 117 | ) |
| 118 | |
| 119 | pw_cc_test( |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 120 | name = "packet_test", |
Alexei Frolov | 5d6d392 | 2020-05-08 13:57:02 -0700 | [diff] [blame] | 121 | srcs = [ |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 122 | "packet_test.cc", |
| 123 | ], |
| 124 | deps = [ |
| 125 | ":common", |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 126 | ], |
| 127 | ) |
| 128 | |
Alexei Frolov | 6560ec8 | 2020-06-03 11:03:05 -0700 | [diff] [blame] | 129 | proto_library( |
| 130 | name = "packet_proto", |
| 131 | srcs = [ |
| 132 | "pw_rpc_protos/packet.proto", |
Wyatt Hepler | 948f547 | 2020-06-02 16:52:28 -0700 | [diff] [blame] | 133 | ], |
Alexei Frolov | 6560ec8 | 2020-06-03 11:03:05 -0700 | [diff] [blame] | 134 | ) |
| 135 | |
Alexei Frolov | 26e3ae6 | 2020-05-04 17:06:17 -0700 | [diff] [blame] | 136 | pw_cc_test( |
| 137 | name = "server_test", |
| 138 | srcs = [ |
| 139 | "server_test.cc", |
| 140 | ], |
| 141 | deps = [ |
| 142 | ":pw_rpc", |
Wyatt Hepler | cb9d957 | 2020-06-01 11:25:58 -0700 | [diff] [blame] | 143 | ":test_utils", |
Wyatt Hepler | 80f26ff | 2020-06-01 09:30:17 -0700 | [diff] [blame] | 144 | "//pw_assert", |
Alexei Frolov | 5d6d392 | 2020-05-08 13:57:02 -0700 | [diff] [blame] | 145 | ], |
| 146 | ) |