Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
| 2 | load("//aos:config.bzl", "aos_config") |
| 3 | |
Brian Silverman | 7a7c24d | 2018-09-01 17:49:09 -0700 | [diff] [blame] | 4 | package(default_visibility = ["//visibility:public"]) |
Brian Silverman | 100534c | 2015-09-07 15:51:23 -0400 | [diff] [blame] | 5 | |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 6 | flatbuffer_cc_library( |
| 7 | name = "connect_fbs", |
| 8 | srcs = ["connect.fbs"], |
| 9 | gen_reflections = 1, |
| 10 | includes = [ |
| 11 | "//aos:configuration_fbs_includes", |
| 12 | ], |
| 13 | ) |
| 14 | |
| 15 | flatbuffer_cc_library( |
| 16 | name = "message_bridge_client_fbs", |
| 17 | srcs = ["message_bridge_client.fbs"], |
| 18 | gen_reflections = 1, |
| 19 | includes = [ |
| 20 | ":message_bridge_server_fbs_includes", |
| 21 | "//aos:configuration_fbs_includes", |
| 22 | ], |
| 23 | ) |
| 24 | |
| 25 | flatbuffer_cc_library( |
| 26 | name = "message_bridge_server_fbs", |
| 27 | srcs = ["message_bridge_server.fbs"], |
| 28 | gen_reflections = 1, |
| 29 | includes = [ |
| 30 | "//aos:configuration_fbs_includes", |
| 31 | ], |
| 32 | ) |
| 33 | |
Brian Silverman | 100534c | 2015-09-07 15:51:23 -0400 | [diff] [blame] | 34 | cc_library( |
Brian Silverman | 7a7c24d | 2018-09-01 17:49:09 -0700 | [diff] [blame] | 35 | name = "team_number", |
| 36 | srcs = [ |
| 37 | "team_number.cc", |
| 38 | ], |
| 39 | hdrs = [ |
| 40 | "team_number.h", |
| 41 | ], |
Brian Silverman | 7a7c24d | 2018-09-01 17:49:09 -0700 | [diff] [blame] | 42 | deps = [ |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 43 | "//aos/logging", |
| 44 | "//aos/util:string_to_num", |
Austin Schuh | dde6405 | 2019-12-11 20:28:00 -0800 | [diff] [blame] | 45 | "@com_google_absl//absl/base", |
Brian Silverman | 7a7c24d | 2018-09-01 17:49:09 -0700 | [diff] [blame] | 46 | ], |
Brian Silverman | 100534c | 2015-09-07 15:51:23 -0400 | [diff] [blame] | 47 | ) |
| 48 | |
Austin Schuh | df5591e | 2015-12-19 22:36:50 -0800 | [diff] [blame] | 49 | cc_test( |
Brian Silverman | 7a7c24d | 2018-09-01 17:49:09 -0700 | [diff] [blame] | 50 | name = "team_number_test", |
| 51 | srcs = [ |
| 52 | "team_number_test.cc", |
| 53 | ], |
| 54 | deps = [ |
| 55 | ":team_number", |
| 56 | "//aos/testing:googletest", |
| 57 | ], |
Austin Schuh | df5591e | 2015-12-19 22:36:50 -0800 | [diff] [blame] | 58 | ) |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 59 | |
| 60 | cc_library( |
| 61 | name = "sctp_lib", |
| 62 | srcs = [ |
| 63 | "sctp_lib.cc", |
| 64 | ], |
| 65 | hdrs = [ |
| 66 | "sctp_lib.h", |
| 67 | ], |
| 68 | copts = [ |
| 69 | # The casts required to read datastructures from sockets trip -Wcast-align. |
| 70 | "-Wno-cast-align", |
| 71 | ], |
| 72 | deps = [ |
| 73 | "//aos:unique_malloc_ptr", |
| 74 | "//third_party/lksctp-tools:sctp", |
| 75 | "@com_github_google_glog//:glog", |
| 76 | ], |
| 77 | ) |
| 78 | |
| 79 | cc_library( |
| 80 | name = "sctp_server", |
| 81 | srcs = [ |
| 82 | "sctp_server.cc", |
| 83 | ], |
| 84 | hdrs = [ |
| 85 | "sctp_server.h", |
| 86 | ], |
| 87 | copts = [ |
| 88 | "-Wno-cast-align", |
| 89 | ], |
| 90 | deps = [ |
| 91 | ":sctp_lib", |
| 92 | "//third_party/lksctp-tools:sctp", |
| 93 | ], |
| 94 | ) |
| 95 | |
| 96 | cc_library( |
| 97 | name = "message_bridge_protocol", |
| 98 | hdrs = [ |
| 99 | "message_bridge_protocol.h", |
| 100 | ], |
| 101 | ) |
| 102 | |
| 103 | cc_library( |
| 104 | name = "message_bridge_server_lib", |
| 105 | srcs = [ |
| 106 | "message_bridge_server_lib.cc", |
| 107 | ], |
| 108 | hdrs = [ |
| 109 | "message_bridge_server_lib.h", |
| 110 | ], |
| 111 | copts = [ |
| 112 | "-Wno-cast-align", |
| 113 | ], |
| 114 | deps = [ |
| 115 | ":connect_fbs", |
| 116 | ":message_bridge_protocol", |
| 117 | ":message_bridge_server_fbs", |
| 118 | ":sctp_lib", |
| 119 | ":sctp_server", |
| 120 | "//aos:unique_malloc_ptr", |
| 121 | "//aos/events:shm_event_loop", |
| 122 | "//aos/events/logging:logger", |
| 123 | "//third_party/lksctp-tools:sctp", |
| 124 | ], |
| 125 | ) |
| 126 | |
| 127 | cc_binary( |
| 128 | name = "message_bridge_server", |
| 129 | srcs = [ |
| 130 | "message_bridge_server.cc", |
| 131 | ], |
| 132 | deps = [ |
| 133 | ":message_bridge_server_lib", |
| 134 | "//aos:init", |
| 135 | "//aos:json_to_flatbuffer", |
| 136 | "//aos/events:shm_event_loop", |
| 137 | ], |
| 138 | ) |
| 139 | |
| 140 | cc_library( |
| 141 | name = "sctp_client", |
| 142 | srcs = [ |
| 143 | "sctp_client.cc", |
| 144 | ], |
| 145 | hdrs = [ |
| 146 | "sctp_client.h", |
| 147 | ], |
| 148 | copts = [ |
| 149 | "-Wno-cast-align", |
| 150 | ], |
| 151 | deps = [ |
| 152 | ":sctp_lib", |
| 153 | "//third_party/lksctp-tools:sctp", |
| 154 | ], |
| 155 | ) |
| 156 | |
| 157 | cc_library( |
| 158 | name = "message_bridge_client_lib", |
| 159 | srcs = [ |
| 160 | "message_bridge_client_lib.cc", |
| 161 | ], |
| 162 | hdrs = [ |
| 163 | "message_bridge_client_lib.h", |
| 164 | ], |
| 165 | copts = [ |
| 166 | "-Wno-cast-align", |
| 167 | ], |
| 168 | deps = [ |
| 169 | ":connect_fbs", |
| 170 | ":message_bridge_client_fbs", |
| 171 | ":message_bridge_protocol", |
| 172 | ":message_bridge_server_fbs", |
| 173 | ":sctp_client", |
| 174 | "//aos/events:shm_event_loop", |
| 175 | "//aos/events/logging:logger", |
| 176 | ], |
| 177 | ) |
| 178 | |
| 179 | cc_binary( |
| 180 | name = "message_bridge_client", |
| 181 | srcs = [ |
| 182 | "message_bridge_client.cc", |
| 183 | ], |
| 184 | copts = [ |
| 185 | "-Wno-cast-align", |
| 186 | ], |
| 187 | deps = [ |
| 188 | ":message_bridge_client_lib", |
| 189 | "//aos:init", |
| 190 | "//aos:json_to_flatbuffer", |
| 191 | "//aos/events:shm_event_loop", |
| 192 | ], |
| 193 | ) |
| 194 | |
| 195 | aos_config( |
| 196 | name = "message_bridge_test_common_config", |
| 197 | src = "message_bridge_test_common.json", |
| 198 | flatbuffers = [ |
| 199 | "//aos/events:ping_fbs", |
| 200 | "//aos/events:pong_fbs", |
| 201 | "//aos/network:message_bridge_client_fbs", |
| 202 | "//aos/network:message_bridge_server_fbs", |
| 203 | ], |
| 204 | deps = ["//aos/events:config"], |
| 205 | ) |
| 206 | |
| 207 | aos_config( |
| 208 | name = "message_bridge_test_server_config", |
| 209 | src = "message_bridge_test_server.json", |
| 210 | deps = [":message_bridge_test_common_config"], |
| 211 | ) |
| 212 | |
| 213 | aos_config( |
| 214 | name = "message_bridge_test_client_config", |
| 215 | src = "message_bridge_test_client.json", |
| 216 | deps = [":message_bridge_test_common_config"], |
| 217 | ) |
| 218 | |
| 219 | cc_test( |
| 220 | name = "message_bridge_test", |
| 221 | srcs = [ |
| 222 | "message_bridge_test.cc", |
| 223 | ], |
| 224 | data = [ |
| 225 | ":message_bridge_test_client_config.json", |
| 226 | ":message_bridge_test_server_config.json", |
| 227 | ], |
| 228 | deps = [ |
| 229 | ":message_bridge_client_lib", |
| 230 | ":message_bridge_server_lib", |
| 231 | "//aos:json_to_flatbuffer", |
| 232 | "//aos/events:ping_fbs", |
| 233 | "//aos/events:pong_fbs", |
| 234 | "//aos/events:shm_event_loop", |
| 235 | "//aos/testing:googletest", |
| 236 | ], |
| 237 | ) |