blob: a905728c8ca0f01f404d4d8d1dd22baa8ff0ad6e [file] [log] [blame]
Alex Perry5f474f22020-02-01 12:14:24 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
Austin Schuh6b9c4152019-11-29 12:45:24 -08002load("//aos:config.bzl", "aos_config")
Alex Perrycb7da4b2019-08-28 19:35:56 -07003
4package(default_visibility = ["//visibility:public"])
5
6flatbuffer_cc_library(
7 name = "test_message_fbs",
8 srcs = ["test_message.fbs"],
9 gen_reflections = 1,
10)
11
12flatbuffer_cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -080013 name = "event_loop_fbs",
14 srcs = ["event_loop.fbs"],
15 gen_reflections = 1,
16 includes = [
17 "//aos:configuration_fbs_includes",
18 ],
19)
20
21flatbuffer_cc_library(
Austin Schuh6b9c4152019-11-29 12:45:24 -080022 name = "ping_fbs",
23 srcs = ["ping.fbs"],
24 gen_reflections = 1,
25)
26
Alex Perry5f474f22020-02-01 12:14:24 -080027flatbuffer_ts_library(
28 name = "ping_ts_fbs",
29 srcs = ["ping.fbs"],
30)
31
Austin Schuh6b9c4152019-11-29 12:45:24 -080032flatbuffer_cc_library(
33 name = "pong_fbs",
34 srcs = ["pong.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070035 gen_reflections = 1,
36)
37
Parker Schuhe4a70d62017-12-27 20:10:20 -080038cc_library(
Austin Schuh6b6dfa52019-06-12 20:16:20 -070039 name = "epoll",
40 srcs = ["epoll.cc"],
41 hdrs = ["epoll.h"],
Austin Schuh20b2b082019-09-11 20:42:56 -070042 visibility = ["//visibility:public"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -070043 deps = [
Austin Schuh6b6dfa52019-06-12 20:16:20 -070044 "//aos/time",
Austin Schuhf257f3c2019-10-27 21:00:43 -070045 "@com_github_google_glog//:glog",
Austin Schuh6b6dfa52019-06-12 20:16:20 -070046 ],
47)
48
Brian Silverman441591b2020-01-31 17:44:32 -080049cc_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 Schuh6b6dfa52019-06-12 20:16:20 -070059cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -070060 name = "event_loop",
Austin Schuh54cf95f2019-11-29 13:14:18 -080061 srcs = [
62 "event_loop.cc",
Austin Schuh7d87b672019-12-01 20:23:49 -080063 "event_loop_event.h",
Austin Schuh54cf95f2019-11-29 13:14:18 -080064 "event_loop_tmpl.h",
65 ],
Austin Schuha1654ed2019-01-27 17:24:54 -080066 hdrs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -070067 "event_loop.h",
Austin Schuha1654ed2019-01-27 17:24:54 -080068 ],
69 visibility = ["//visibility:public"],
70 deps = [
Austin Schuh39788ff2019-12-01 18:22:57 -080071 ":event_loop_fbs",
72 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -070073 "//aos:configuration",
74 "//aos:configuration_fbs",
75 "//aos:flatbuffers",
Brian Silvermana1652f32020-01-29 20:41:44 -080076 "//aos/ipc_lib:data_alignment",
Tyler Chatow67ddb032020-01-12 14:30:04 -080077 "//aos/logging:implementations",
Austin Schuha1654ed2019-01-27 17:24:54 -080078 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080079 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070080 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080081 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070082 ],
83)
84
Austin Schuh6b9c4152019-11-29 12:45:24 -080085cc_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 Perrycb7da4b2019-08-28 19:35:56 -0700102cc_binary(
103 name = "ping",
104 srcs = [
105 "ping.cc",
106 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800107 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700108 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800109 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700110 ":shm_event_loop",
111 "//aos:configuration",
112 "//aos:init",
113 "//aos:json_to_flatbuffer",
114 "@com_github_google_glog//:glog",
115 ],
116)
117
Austin Schuh6b9c4152019-11-29 12:45:24 -0800118aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800119 name = "config",
120 src = "aos.json",
121 flatbuffers = [
122 ":event_loop_fbs",
Tyler Chatow67ddb032020-01-12 14:30:04 -0800123 "//aos/logging:log_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800124 ],
125)
126
127aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800128 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800129 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800130 flatbuffers = [
131 ":ping_fbs",
132 ":pong_fbs",
133 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800134 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800135)
136
Austin Schuh15649d62019-12-28 16:36:38 -0800137aos_config(
138 name = "multinode_pingpong_config",
139 src = "multinode_pingpong.json",
140 flatbuffers = [
141 ":ping_fbs",
142 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800143 "//aos/network:message_bridge_client_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800144 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800145 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800146 ],
147 deps = [":config"],
148)
149
Austin Schuh6b9c4152019-11-29 12:45:24 -0800150cc_library(
151 name = "pong_lib",
152 srcs = [
153 "pong_lib.cc",
154 ],
155 hdrs = [
156 "pong_lib.h",
157 ],
158 deps = [
159 ":event_loop",
160 ":ping_fbs",
161 ":pong_fbs",
162 "@com_github_google_glog//:glog",
163 ],
164)
165
Alex Perrycb7da4b2019-08-28 19:35:56 -0700166cc_binary(
167 name = "pong",
168 srcs = [
169 "pong.cc",
170 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800171 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700172 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800173 ":ping_fbs",
174 ":pong_fbs",
175 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700176 ":shm_event_loop",
177 "//aos:configuration",
178 "//aos:init",
179 "//aos:json_to_flatbuffer",
180 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800181 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800182)
183
Austin Schuh6b9c4152019-11-29 12:45:24 -0800184cc_test(
185 name = "pingpong_test",
186 srcs = ["pingpong_test.cc"],
187 data = [":pingpong_config.json"],
188 deps = [
189 ":ping_lib",
190 ":pong_lib",
191 ":simulated_event_loop",
192 "//aos:configuration",
193 "//aos:flatbuffers",
194 "//aos/testing:googletest",
195 ],
196)
197
Parker Schuhe4a70d62017-12-27 20:10:20 -0800198cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800199 name = "timing_statistics",
200 srcs = ["timing_statistics.cc"],
201 hdrs = ["timing_statistics.h"],
202 deps = [
203 ":event_loop_fbs",
204 "//aos:configuration",
205 "@com_github_google_glog//:glog",
206 ],
207)
208
209cc_test(
210 name = "timing_statistics_test",
211 srcs = ["timing_statistics_test.cc"],
212 deps = [
213 ":timing_statistics",
214 "//aos:configuration",
215 "//aos:flatbuffers",
216 "//aos/testing:googletest",
217 ],
218)
219
220cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700221 name = "shm_event_loop",
222 srcs = ["shm_event_loop.cc"],
223 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800224 visibility = ["//visibility:public"],
225 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800226 ":aos_logging",
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700227 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700228 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800229 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700230 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800231 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700232 "//aos:realtime",
233 "//aos/ipc_lib:lockless_queue",
234 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800235 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700236 "//aos/util:phased_loop",
Brian Silverman441591b2020-01-31 17:44:32 -0800237 "@com_google_absl//absl/base",
Austin Schuha1654ed2019-01-27 17:24:54 -0800238 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800239)
240
241cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700242 name = "shm_event_loop_test",
243 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700244 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800245 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700246 ":event_loop_param_test",
247 ":shm_event_loop",
248 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800249 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800250)
251
252cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700253 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800254 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700255 srcs = ["event_loop_param_test.cc"],
256 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800257 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700258 ":event_loop",
259 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800260 "//aos/testing:googletest",
261 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800262)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800263
264cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700265 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700266 srcs = ["simulated_event_loop_test.cc"],
Austin Schuh898f4972020-01-11 17:21:25 -0800267 data = ["multinode_pingpong_config.json"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800268 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700269 ":event_loop_param_test",
Austin Schuh898f4972020-01-11 17:21:25 -0800270 ":ping_lib",
271 ":pong_lib",
Austin Schuh7267c532019-05-19 19:55:53 -0700272 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800273 "//aos/testing:googletest",
274 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800275)
276
277cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800278 name = "simple_channel",
279 srcs = ["simple_channel.cc"],
280 hdrs = ["simple_channel.h"],
281 deps = [
282 "//aos:configuration_fbs",
283 "@com_github_google_flatbuffers//:flatbuffers",
284 "@com_github_google_glog//:glog",
285 "@com_google_absl//absl/strings",
286 ],
287)
288
289cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700290 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700291 srcs = [
292 "event_scheduler.cc",
293 "simulated_event_loop.cc",
Austin Schuh898f4972020-01-11 17:21:25 -0800294 "simulated_network_bridge.cc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700295 ],
296 hdrs = [
297 "event_scheduler.h",
298 "simulated_event_loop.h",
Austin Schuh898f4972020-01-11 17:21:25 -0800299 "simulated_network_bridge.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700300 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700301 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800302 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800303 ":aos_logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700304 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800305 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700306 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700307 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700308 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800309 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800310)
Tyler Chatow67ddb032020-01-12 14:30:04 -0800311
312cc_library(
313 name = "aos_logging",
314 srcs = [
315 "aos_logging.cc",
316 ],
317 hdrs = [
318 "aos_logging.h",
319 ],
320 visibility = ["//visibility:public"],
321 deps = [
322 ":event_loop",
323 "//aos/logging:implementations",
324 "//aos/logging:log_message_fbs",
325 ],
326)