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