blob: 81b9e16e2b941895e39f73b73dc233953e32e1b9 [file] [log] [blame]
Philipp Schrader3de4dfc2023-02-15 20:18:25 -08001load("//tools/build_rules:js.bzl", "rollup_bundle", "ts_project")
James Kuszmaulabb77132020-08-01 19:56:16 -07002load("//aos:config.bzl", "aos_config")
Alex Perryb3b50792020-01-18 16:13:45 -08003
Austin Schuhfcd56942022-07-18 17:41:32 -07004exports_files(["styles.css"])
5
Alex Perryb3b50792020-01-18 16:13:45 -08006filegroup(
7 name = "files",
8 srcs = glob([
9 "**/*.html",
Alex Perry5f474f22020-02-01 12:14:24 -080010 "**/*.css",
Alex Perryb3b50792020-01-18 16:13:45 -080011 ]),
Austin Schuha4f69d62020-02-28 13:58:14 -080012 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080013)
14
Philipp Schrader3de4dfc2023-02-15 20:18:25 -080015ts_project(
Alex Perryb3b50792020-01-18 16:13:45 -080016 name = "proxy",
Alex Perry5f474f22020-02-01 12:14:24 -080017 srcs = [
18 "config_handler.ts",
19 "proxy.ts",
20 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080021 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080022 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080023 deps = [
James Kuszmaul527038a2020-12-21 23:40:44 -080024 ":reflection_ts",
Alex Perryd5e13572020-02-22 15:15:08 -080025 "//aos:configuration_ts_fbs",
Austin Schuha4f69d62020-02-28 13:58:14 -080026 "//aos/network:connect_ts_fbs",
27 "//aos/network:web_proxy_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -070028 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080029 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080030 ],
Alex Perry5f474f22020-02-01 12:14:24 -080031)
32
Philipp Schrader3de4dfc2023-02-15 20:18:25 -080033ts_project(
Alex Perry5f474f22020-02-01 12:14:24 -080034 name = "main",
35 srcs = [
36 "main.ts",
37 "ping_handler.ts",
38 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080039 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -080040 deps = [
41 ":proxy",
42 "//aos/events:ping_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -070043 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perry5f474f22020-02-01 12:14:24 -080044 ],
Alex Perryb3b50792020-01-18 16:13:45 -080045)
46
47rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080048 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070049 entry_point = "main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -080050 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080051 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080052 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070053 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080054 ],
Alex Perryb3b50792020-01-18 16:13:45 -080055)
56
57genrule(
58 name = "flatbuffers",
59 srcs = [
60 "@com_github_google_flatbuffers//:flatjs",
61 ],
62 outs = [
63 "flatbuffers.js",
64 ],
65 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Philipp Schraderdada1072020-11-24 11:34:46 -080066 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080067 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080068)
James Kuszmaulabb77132020-08-01 19:56:16 -070069
Philipp Schrader3de4dfc2023-02-15 20:18:25 -080070ts_project(
James Kuszmaulabb77132020-08-01 19:56:16 -070071 name = "reflection_test_main",
72 srcs = [
73 "reflection_test_main.ts",
74 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080075 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -070076 deps = [
77 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080078 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080079 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070080 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080081 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070082 ],
83)
84
Philipp Schrader3de4dfc2023-02-15 20:18:25 -080085ts_project(
James Kuszmaulabb77132020-08-01 19:56:16 -070086 name = "reflection_ts",
87 srcs = ["reflection.ts"],
Philipp Schraderdada1072020-11-24 11:34:46 -080088 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070089 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080090 deps = [
91 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080092 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmauldac091f2022-03-22 09:35:06 -070093 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080094 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
95 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070096)
97
Philipp Schrader3de4dfc2023-02-15 20:18:25 -080098ts_project(
James Kuszmaul933a9742021-03-07 19:59:06 -080099 name = "colors",
100 srcs = [
101 "colors.ts",
102 ],
103 target_compatible_with = ["@platforms//os:linux"],
104 visibility = ["//visibility:public"],
105)
106
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800107ts_project(
James Kuszmaula8f2c452020-07-05 21:17:56 -0700108 name = "plotter",
109 srcs = [
110 "plotter.ts",
111 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800112 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700113 visibility = ["//visibility:public"],
James Kuszmaul933a9742021-03-07 19:59:06 -0800114 deps = [":colors"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700115)
116
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800117ts_project(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800118 name = "aos_plotter",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700119 srcs = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800120 "aos_plotter.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700121 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800122 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800123 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700124 deps = [
125 ":plotter",
126 ":proxy",
127 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700128 "//aos:configuration_ts_fbs",
129 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800130 "//aos/network:web_proxy_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -0700131 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700132 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700133 ],
134)
135
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800136ts_project(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800137 name = "demo_plot",
138 srcs = [
139 "demo_plot.ts",
140 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800141 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800142 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700143 deps = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800144 ":aos_plotter",
145 ":plotter",
146 ":proxy",
147 ":reflection_ts",
148 "//aos:configuration_ts_fbs",
149 "//aos/network:connect_ts_fbs",
150 "//aos/network:web_proxy_ts_fbs",
151 "//frc971/wpilib:imu_batch_ts_fbs",
152 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700153 ],
154)
155
James Kuszmaulabb77132020-08-01 19:56:16 -0700156aos_config(
157 name = "test_config",
158 src = "test_config_file.json",
159 flatbuffers = [
160 "//aos:configuration_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800161 "//aos:json_to_flatbuffer_fbs",
James Kuszmaulabb77132020-08-01 19:56:16 -0700162 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800163 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800164 visibility = ["//visibility:public"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700165 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800166 "//aos/events:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700167 ],
168)
169
170rollup_bundle(
171 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700172 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800173 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700174 deps = [
175 ":reflection_test_main",
176 ],
177)
178
179sh_binary(
180 name = "web_proxy_demo",
181 srcs = ["web_proxy_demo.sh"],
182 data = [
James Kuszmaulabb77132020-08-01 19:56:16 -0700183 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700184 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700185 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700186 "//aos/network:web_proxy_main",
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800187 "//y2020:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700188 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800189 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700190)