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