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