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