blob: d35f2061c8b934f538cdea6eb2dfd49081a08be1 [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 = [
Austin Schuh1af273d2020-03-07 20:11:34 -080067 "channel_preallocated_allocator.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -070068 "event_loop.h",
Austin Schuha1654ed2019-01-27 17:24:54 -080069 ],
70 visibility = ["//visibility:public"],
71 deps = [
Austin Schuh39788ff2019-12-01 18:22:57 -080072 ":event_loop_fbs",
73 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -070074 "//aos:configuration",
75 "//aos:configuration_fbs",
76 "//aos:flatbuffers",
Brian Silvermana1652f32020-01-29 20:41:44 -080077 "//aos/ipc_lib:data_alignment",
Tyler Chatow67ddb032020-01-12 14:30:04 -080078 "//aos/logging:implementations",
Austin Schuha1654ed2019-01-27 17:24:54 -080079 "//aos/time",
Austin Schuh39788ff2019-12-01 18:22:57 -080080 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -070081 "@com_github_google_flatbuffers//:flatbuffers",
Brian Silverman0fc69932020-01-24 21:54:02 -080082 "@com_google_absl//absl/container:btree",
Alex Perrycb7da4b2019-08-28 19:35:56 -070083 ],
84)
85
Austin Schuh6b9c4152019-11-29 12:45:24 -080086cc_library(
87 name = "ping_lib",
88 srcs = [
89 "ping_lib.cc",
90 ],
91 hdrs = [
92 "ping_lib.h",
93 ],
94 deps = [
95 ":event_loop",
96 ":ping_fbs",
97 ":pong_fbs",
98 "//aos:json_to_flatbuffer",
99 "@com_github_google_glog//:glog",
100 ],
101)
102
Alex Perrycb7da4b2019-08-28 19:35:56 -0700103cc_binary(
104 name = "ping",
105 srcs = [
106 "ping.cc",
107 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800108 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700109 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800110 ":ping_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700111 ":shm_event_loop",
112 "//aos:configuration",
113 "//aos:init",
114 "//aos:json_to_flatbuffer",
115 "@com_github_google_glog//:glog",
116 ],
117)
118
Austin Schuh6b9c4152019-11-29 12:45:24 -0800119aos_config(
Austin Schuh39788ff2019-12-01 18:22:57 -0800120 name = "config",
121 src = "aos.json",
122 flatbuffers = [
123 ":event_loop_fbs",
Tyler Chatow67ddb032020-01-12 14:30:04 -0800124 "//aos/logging:log_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800125 ],
126)
127
128aos_config(
Austin Schuh6b9c4152019-11-29 12:45:24 -0800129 name = "pingpong_config",
Austin Schuh39788ff2019-12-01 18:22:57 -0800130 src = "pingpong.json",
Austin Schuh6b9c4152019-11-29 12:45:24 -0800131 flatbuffers = [
132 ":ping_fbs",
133 ":pong_fbs",
134 ],
Austin Schuh39788ff2019-12-01 18:22:57 -0800135 deps = [":config"],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800136)
137
Austin Schuh15649d62019-12-28 16:36:38 -0800138aos_config(
139 name = "multinode_pingpong_config",
140 src = "multinode_pingpong.json",
141 flatbuffers = [
142 ":ping_fbs",
143 ":pong_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800144 "//aos/network:message_bridge_client_fbs",
Austin Schuh7bc59052020-02-16 23:48:33 -0800145 "//aos/network:timestamp_fbs",
Austin Schuhe84c3ed2019-12-14 15:29:48 -0800146 "//aos/network:message_bridge_server_fbs",
Austin Schuh15649d62019-12-28 16:36:38 -0800147 ],
148 deps = [":config"],
149)
150
Austin Schuh6b9c4152019-11-29 12:45:24 -0800151cc_library(
152 name = "pong_lib",
153 srcs = [
154 "pong_lib.cc",
155 ],
156 hdrs = [
157 "pong_lib.h",
158 ],
159 deps = [
160 ":event_loop",
161 ":ping_fbs",
162 ":pong_fbs",
163 "@com_github_google_glog//:glog",
164 ],
165)
166
Alex Perrycb7da4b2019-08-28 19:35:56 -0700167cc_binary(
168 name = "pong",
169 srcs = [
170 "pong.cc",
171 ],
Austin Schuh6b9c4152019-11-29 12:45:24 -0800172 data = ["pingpong_config.json"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700173 deps = [
Austin Schuh6b9c4152019-11-29 12:45:24 -0800174 ":ping_fbs",
175 ":pong_fbs",
176 ":pong_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700177 ":shm_event_loop",
178 "//aos:configuration",
179 "//aos:init",
180 "//aos:json_to_flatbuffer",
181 "@com_github_google_glog//:glog",
Austin Schuha1654ed2019-01-27 17:24:54 -0800182 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800183)
184
Austin Schuh6b9c4152019-11-29 12:45:24 -0800185cc_test(
186 name = "pingpong_test",
187 srcs = ["pingpong_test.cc"],
188 data = [":pingpong_config.json"],
189 deps = [
190 ":ping_lib",
191 ":pong_lib",
192 ":simulated_event_loop",
193 "//aos:configuration",
194 "//aos:flatbuffers",
195 "//aos/testing:googletest",
196 ],
197)
198
Parker Schuhe4a70d62017-12-27 20:10:20 -0800199cc_library(
Austin Schuhe4106142019-12-01 18:19:53 -0800200 name = "timing_statistics",
201 srcs = ["timing_statistics.cc"],
202 hdrs = ["timing_statistics.h"],
203 deps = [
204 ":event_loop_fbs",
205 "//aos:configuration",
206 "@com_github_google_glog//:glog",
207 ],
208)
209
210cc_test(
211 name = "timing_statistics_test",
212 srcs = ["timing_statistics_test.cc"],
213 deps = [
214 ":timing_statistics",
215 "//aos:configuration",
216 "//aos:flatbuffers",
217 "//aos/testing:googletest",
218 ],
219)
220
221cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 name = "shm_event_loop",
223 srcs = ["shm_event_loop.cc"],
224 hdrs = ["shm_event_loop.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800225 visibility = ["//visibility:public"],
226 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800227 ":aos_logging",
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700228 ":epoll",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700229 ":event_loop",
Austin Schuh39788ff2019-12-01 18:22:57 -0800230 ":event_loop_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700231 ":test_message_fbs",
Austin Schuh39788ff2019-12-01 18:22:57 -0800232 ":timing_statistics",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700233 "//aos:realtime",
234 "//aos/ipc_lib:lockless_queue",
235 "//aos/ipc_lib:signalfd",
Austin Schuh32fd5a72019-12-01 22:20:26 -0800236 "//aos/stl_mutex",
Austin Schuh52d325c2019-06-23 18:59:06 -0700237 "//aos/util:phased_loop",
Brian Silverman441591b2020-01-31 17:44:32 -0800238 "@com_google_absl//absl/base",
Austin Schuha1654ed2019-01-27 17:24:54 -0800239 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800240)
241
242cc_test(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700243 name = "shm_event_loop_test",
244 srcs = ["shm_event_loop_test.cc"],
Austin Schuh6b6dfa52019-06-12 20:16:20 -0700245 shard_count = 5,
Austin Schuha1654ed2019-01-27 17:24:54 -0800246 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700247 ":event_loop_param_test",
248 ":shm_event_loop",
249 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800250 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800251)
252
253cc_library(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700254 name = "event_loop_param_test",
Austin Schuha1654ed2019-01-27 17:24:54 -0800255 testonly = True,
Alex Perrycb7da4b2019-08-28 19:35:56 -0700256 srcs = ["event_loop_param_test.cc"],
257 hdrs = ["event_loop_param_test.h"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800258 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700259 ":event_loop",
260 ":test_message_fbs",
Austin Schuha1654ed2019-01-27 17:24:54 -0800261 "//aos/testing:googletest",
262 ],
Parker Schuhe4a70d62017-12-27 20:10:20 -0800263)
Neil Balchc8f41ed2018-01-20 22:06:53 -0800264
265cc_test(
Austin Schuh7267c532019-05-19 19:55:53 -0700266 name = "simulated_event_loop_test",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700267 srcs = ["simulated_event_loop_test.cc"],
Austin Schuh898f4972020-01-11 17:21:25 -0800268 data = ["multinode_pingpong_config.json"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800269 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700270 ":event_loop_param_test",
Austin Schuh898f4972020-01-11 17:21:25 -0800271 ":ping_lib",
272 ":pong_lib",
Austin Schuh7267c532019-05-19 19:55:53 -0700273 ":simulated_event_loop",
Austin Schuha1654ed2019-01-27 17:24:54 -0800274 "//aos/testing:googletest",
275 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800276)
277
278cc_library(
Austin Schuhe1dafe42020-01-06 21:12:03 -0800279 name = "simple_channel",
280 srcs = ["simple_channel.cc"],
281 hdrs = ["simple_channel.h"],
282 deps = [
283 "//aos:configuration_fbs",
284 "@com_github_google_flatbuffers//:flatbuffers",
285 "@com_github_google_glog//:glog",
286 "@com_google_absl//absl/strings",
287 ],
288)
289
290cc_library(
Austin Schuh7267c532019-05-19 19:55:53 -0700291 name = "simulated_event_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700292 srcs = [
293 "event_scheduler.cc",
294 "simulated_event_loop.cc",
Austin Schuh898f4972020-01-11 17:21:25 -0800295 "simulated_network_bridge.cc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700296 ],
297 hdrs = [
298 "event_scheduler.h",
299 "simulated_event_loop.h",
Austin Schuh898f4972020-01-11 17:21:25 -0800300 "simulated_network_bridge.h",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700301 ],
Austin Schuh7267c532019-05-19 19:55:53 -0700302 visibility = ["//visibility:public"],
Austin Schuha1654ed2019-01-27 17:24:54 -0800303 deps = [
Tyler Chatow67ddb032020-01-12 14:30:04 -0800304 ":aos_logging",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700305 ":event_loop",
Austin Schuhe1dafe42020-01-06 21:12:03 -0800306 ":simple_channel",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700307 "//aos/ipc_lib:index",
Austin Schuh52d325c2019-06-23 18:59:06 -0700308 "//aos/util:phased_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700309 "@com_google_absl//absl/container:btree",
Austin Schuha1654ed2019-01-27 17:24:54 -0800310 ],
Neil Balchc8f41ed2018-01-20 22:06:53 -0800311)
Tyler Chatow67ddb032020-01-12 14:30:04 -0800312
313cc_library(
314 name = "aos_logging",
315 srcs = [
316 "aos_logging.cc",
317 ],
318 hdrs = [
319 "aos_logging.h",
320 ],
321 visibility = ["//visibility:public"],
322 deps = [
323 ":event_loop",
324 "//aos/logging:implementations",
325 "//aos/logging:log_message_fbs",
326 ],
327)