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