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