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