Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 2 | load("//aos:config.bzl", "aos_config") |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 3 | |
| 4 | package(default_visibility = ["//visibility:public"]) |
| 5 | |
| 6 | flatbuffer_cc_library( |
| 7 | name = "test_message_fbs", |
| 8 | srcs = ["test_message.fbs"], |
| 9 | gen_reflections = 1, |
| 10 | ) |
| 11 | |
| 12 | flatbuffer_cc_library( |
Austin Schuh | e410614 | 2019-12-01 18:19:53 -0800 | [diff] [blame] | 13 | name = "event_loop_fbs", |
| 14 | srcs = ["event_loop.fbs"], |
| 15 | gen_reflections = 1, |
| 16 | includes = [ |
| 17 | "//aos:configuration_fbs_includes", |
| 18 | ], |
| 19 | ) |
| 20 | |
| 21 | flatbuffer_cc_library( |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 22 | name = "ping_fbs", |
| 23 | srcs = ["ping.fbs"], |
| 24 | gen_reflections = 1, |
| 25 | ) |
| 26 | |
| 27 | flatbuffer_cc_library( |
| 28 | name = "pong_fbs", |
| 29 | srcs = ["pong.fbs"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 30 | gen_reflections = 1, |
| 31 | ) |
| 32 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 33 | cc_library( |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 34 | name = "epoll", |
| 35 | srcs = ["epoll.cc"], |
| 36 | hdrs = ["epoll.h"], |
Austin Schuh | 20b2b08 | 2019-09-11 20:42:56 -0700 | [diff] [blame] | 37 | visibility = ["//visibility:public"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 38 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 39 | "//aos/time", |
Austin Schuh | f257f3c | 2019-10-27 21:00:43 -0700 | [diff] [blame] | 40 | "@com_github_google_glog//:glog", |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 41 | ], |
| 42 | ) |
| 43 | |
Brian Silverman | 441591b | 2020-01-31 17:44:32 -0800 | [diff] [blame] | 44 | cc_test( |
| 45 | name = "epoll_test", |
| 46 | srcs = ["epoll_test.cc"], |
| 47 | deps = [ |
| 48 | ":epoll", |
| 49 | "//aos/testing:googletest", |
| 50 | "@com_github_google_glog//:glog", |
| 51 | ], |
| 52 | ) |
| 53 | |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 54 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 55 | name = "event_loop", |
Austin Schuh | 54cf95f | 2019-11-29 13:14:18 -0800 | [diff] [blame] | 56 | srcs = [ |
| 57 | "event_loop.cc", |
Austin Schuh | 7d87b67 | 2019-12-01 20:23:49 -0800 | [diff] [blame] | 58 | "event_loop_event.h", |
Austin Schuh | 54cf95f | 2019-11-29 13:14:18 -0800 | [diff] [blame] | 59 | "event_loop_tmpl.h", |
| 60 | ], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 61 | hdrs = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 62 | "event_loop.h", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 63 | ], |
| 64 | visibility = ["//visibility:public"], |
| 65 | deps = [ |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 66 | ":event_loop_fbs", |
| 67 | ":timing_statistics", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 68 | "//aos:configuration", |
| 69 | "//aos:configuration_fbs", |
| 70 | "//aos:flatbuffers", |
Brian Silverman | a1652f3 | 2020-01-29 20:41:44 -0800 | [diff] [blame] | 71 | "//aos/ipc_lib:data_alignment", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 72 | "//aos/time", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 73 | "//aos/util:phased_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 74 | "@com_github_google_flatbuffers//:flatbuffers", |
Brian Silverman | 0fc6993 | 2020-01-24 21:54:02 -0800 | [diff] [blame] | 75 | "@com_google_absl//absl/container:btree", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 76 | ], |
| 77 | ) |
| 78 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 79 | cc_library( |
| 80 | name = "ping_lib", |
| 81 | srcs = [ |
| 82 | "ping_lib.cc", |
| 83 | ], |
| 84 | hdrs = [ |
| 85 | "ping_lib.h", |
| 86 | ], |
| 87 | deps = [ |
| 88 | ":event_loop", |
| 89 | ":ping_fbs", |
| 90 | ":pong_fbs", |
| 91 | "//aos:json_to_flatbuffer", |
| 92 | "@com_github_google_glog//:glog", |
| 93 | ], |
| 94 | ) |
| 95 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 96 | cc_binary( |
| 97 | name = "ping", |
| 98 | srcs = [ |
| 99 | "ping.cc", |
| 100 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 101 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 102 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 103 | ":ping_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 104 | ":shm_event_loop", |
| 105 | "//aos:configuration", |
| 106 | "//aos:init", |
| 107 | "//aos:json_to_flatbuffer", |
| 108 | "@com_github_google_glog//:glog", |
| 109 | ], |
| 110 | ) |
| 111 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 112 | aos_config( |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 113 | name = "config", |
| 114 | src = "aos.json", |
| 115 | flatbuffers = [ |
| 116 | ":event_loop_fbs", |
| 117 | ], |
| 118 | ) |
| 119 | |
| 120 | aos_config( |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 121 | name = "pingpong_config", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 122 | src = "pingpong.json", |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 123 | flatbuffers = [ |
| 124 | ":ping_fbs", |
| 125 | ":pong_fbs", |
| 126 | ], |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 127 | deps = [":config"], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 128 | ) |
| 129 | |
Austin Schuh | 15649d6 | 2019-12-28 16:36:38 -0800 | [diff] [blame] | 130 | aos_config( |
| 131 | name = "multinode_pingpong_config", |
| 132 | src = "multinode_pingpong.json", |
| 133 | flatbuffers = [ |
| 134 | ":ping_fbs", |
| 135 | ":pong_fbs", |
Austin Schuh | e84c3ed | 2019-12-14 15:29:48 -0800 | [diff] [blame] | 136 | "//aos/network:message_bridge_client_fbs", |
| 137 | "//aos/network:message_bridge_server_fbs", |
Austin Schuh | 15649d6 | 2019-12-28 16:36:38 -0800 | [diff] [blame] | 138 | ], |
| 139 | deps = [":config"], |
| 140 | ) |
| 141 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 142 | cc_library( |
| 143 | name = "pong_lib", |
| 144 | srcs = [ |
| 145 | "pong_lib.cc", |
| 146 | ], |
| 147 | hdrs = [ |
| 148 | "pong_lib.h", |
| 149 | ], |
| 150 | deps = [ |
| 151 | ":event_loop", |
| 152 | ":ping_fbs", |
| 153 | ":pong_fbs", |
| 154 | "@com_github_google_glog//:glog", |
| 155 | ], |
| 156 | ) |
| 157 | |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 158 | cc_binary( |
| 159 | name = "pong", |
| 160 | srcs = [ |
| 161 | "pong.cc", |
| 162 | ], |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 163 | data = ["pingpong_config.json"], |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 164 | deps = [ |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 165 | ":ping_fbs", |
| 166 | ":pong_fbs", |
| 167 | ":pong_lib", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 168 | ":shm_event_loop", |
| 169 | "//aos:configuration", |
| 170 | "//aos:init", |
| 171 | "//aos:json_to_flatbuffer", |
| 172 | "@com_github_google_glog//:glog", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 173 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 174 | ) |
| 175 | |
Austin Schuh | 6b9c415 | 2019-11-29 12:45:24 -0800 | [diff] [blame] | 176 | cc_test( |
| 177 | name = "pingpong_test", |
| 178 | srcs = ["pingpong_test.cc"], |
| 179 | data = [":pingpong_config.json"], |
| 180 | deps = [ |
| 181 | ":ping_lib", |
| 182 | ":pong_lib", |
| 183 | ":simulated_event_loop", |
| 184 | "//aos:configuration", |
| 185 | "//aos:flatbuffers", |
| 186 | "//aos/testing:googletest", |
| 187 | ], |
| 188 | ) |
| 189 | |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 190 | cc_library( |
Austin Schuh | e410614 | 2019-12-01 18:19:53 -0800 | [diff] [blame] | 191 | name = "timing_statistics", |
| 192 | srcs = ["timing_statistics.cc"], |
| 193 | hdrs = ["timing_statistics.h"], |
| 194 | deps = [ |
| 195 | ":event_loop_fbs", |
| 196 | "//aos:configuration", |
| 197 | "@com_github_google_glog//:glog", |
| 198 | ], |
| 199 | ) |
| 200 | |
| 201 | cc_test( |
| 202 | name = "timing_statistics_test", |
| 203 | srcs = ["timing_statistics_test.cc"], |
| 204 | deps = [ |
| 205 | ":timing_statistics", |
| 206 | "//aos:configuration", |
| 207 | "//aos:flatbuffers", |
| 208 | "//aos/testing:googletest", |
| 209 | ], |
| 210 | ) |
| 211 | |
| 212 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 213 | name = "shm_event_loop", |
| 214 | srcs = ["shm_event_loop.cc"], |
| 215 | hdrs = ["shm_event_loop.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 216 | visibility = ["//visibility:public"], |
| 217 | deps = [ |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 218 | ":epoll", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 219 | ":event_loop", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 220 | ":event_loop_fbs", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 221 | ":test_message_fbs", |
Austin Schuh | 39788ff | 2019-12-01 18:22:57 -0800 | [diff] [blame] | 222 | ":timing_statistics", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 223 | "//aos:realtime", |
| 224 | "//aos/ipc_lib:lockless_queue", |
| 225 | "//aos/ipc_lib:signalfd", |
Austin Schuh | 32fd5a7 | 2019-12-01 22:20:26 -0800 | [diff] [blame] | 226 | "//aos/stl_mutex", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 227 | "//aos/util:phased_loop", |
Brian Silverman | 441591b | 2020-01-31 17:44:32 -0800 | [diff] [blame] | 228 | "@com_google_absl//absl/base", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 229 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 230 | ) |
| 231 | |
| 232 | cc_test( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 233 | name = "shm_event_loop_test", |
| 234 | srcs = ["shm_event_loop_test.cc"], |
Austin Schuh | 6b6dfa5 | 2019-06-12 20:16:20 -0700 | [diff] [blame] | 235 | shard_count = 5, |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 236 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 237 | ":event_loop_param_test", |
| 238 | ":shm_event_loop", |
| 239 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 240 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 241 | ) |
| 242 | |
| 243 | cc_library( |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 244 | name = "event_loop_param_test", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 245 | testonly = True, |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 246 | srcs = ["event_loop_param_test.cc"], |
| 247 | hdrs = ["event_loop_param_test.h"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 248 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 249 | ":event_loop", |
| 250 | ":test_message_fbs", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 251 | "//aos/testing:googletest", |
| 252 | ], |
Parker Schuh | e4a70d6 | 2017-12-27 20:10:20 -0800 | [diff] [blame] | 253 | ) |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 254 | |
| 255 | cc_test( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 256 | name = "simulated_event_loop_test", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 257 | srcs = ["simulated_event_loop_test.cc"], |
Austin Schuh | 898f497 | 2020-01-11 17:21:25 -0800 | [diff] [blame] | 258 | data = ["multinode_pingpong_config.json"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 259 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 260 | ":event_loop_param_test", |
Austin Schuh | 898f497 | 2020-01-11 17:21:25 -0800 | [diff] [blame] | 261 | ":ping_lib", |
| 262 | ":pong_lib", |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 263 | ":simulated_event_loop", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 264 | "//aos/testing:googletest", |
| 265 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 266 | ) |
| 267 | |
| 268 | cc_library( |
Austin Schuh | e1dafe4 | 2020-01-06 21:12:03 -0800 | [diff] [blame] | 269 | name = "simple_channel", |
| 270 | srcs = ["simple_channel.cc"], |
| 271 | hdrs = ["simple_channel.h"], |
| 272 | deps = [ |
| 273 | "//aos:configuration_fbs", |
| 274 | "@com_github_google_flatbuffers//:flatbuffers", |
| 275 | "@com_github_google_glog//:glog", |
| 276 | "@com_google_absl//absl/strings", |
| 277 | ], |
| 278 | ) |
| 279 | |
| 280 | cc_library( |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 281 | name = "simulated_event_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 282 | srcs = [ |
| 283 | "event_scheduler.cc", |
| 284 | "simulated_event_loop.cc", |
Austin Schuh | 898f497 | 2020-01-11 17:21:25 -0800 | [diff] [blame] | 285 | "simulated_network_bridge.cc", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 286 | ], |
| 287 | hdrs = [ |
| 288 | "event_scheduler.h", |
| 289 | "simulated_event_loop.h", |
Austin Schuh | 898f497 | 2020-01-11 17:21:25 -0800 | [diff] [blame] | 290 | "simulated_network_bridge.h", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 291 | ], |
Austin Schuh | 7267c53 | 2019-05-19 19:55:53 -0700 | [diff] [blame] | 292 | visibility = ["//visibility:public"], |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 293 | deps = [ |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 294 | ":event_loop", |
Austin Schuh | e1dafe4 | 2020-01-06 21:12:03 -0800 | [diff] [blame] | 295 | ":simple_channel", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 296 | "//aos/ipc_lib:index", |
Austin Schuh | 52d325c | 2019-06-23 18:59:06 -0700 | [diff] [blame] | 297 | "//aos/util:phased_loop", |
Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 298 | "@com_google_absl//absl/container:btree", |
Austin Schuh | a1654ed | 2019-01-27 17:24:54 -0800 | [diff] [blame] | 299 | ], |
Neil Balch | c8f41ed | 2018-01-20 22:06:53 -0800 | [diff] [blame] | 300 | ) |