blob: 442e8bea2bcdf4c8762ae41c75ee5102362e86b9 [file] [log] [blame]
Philipp Schrader87277f42022-01-01 07:45:12 -08001load("@npm//@bazel/typescript:index.bzl", "ts_library")
2load("//tools/build_rules:js.bzl", "rollup_bundle")
James Kuszmaulabb77132020-08-01 19:56:16 -07003load("//aos:config.bzl", "aos_config")
Alex Perryb3b50792020-01-18 16:13:45 -08004
5filegroup(
6 name = "files",
7 srcs = glob([
8 "**/*.html",
Alex Perry5f474f22020-02-01 12:14:24 -08009 "**/*.css",
Alex Perryb3b50792020-01-18 16:13:45 -080010 ]),
Austin Schuha4f69d62020-02-28 13:58:14 -080011 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080012)
13
14ts_library(
15 name = "proxy",
Alex Perry5f474f22020-02-01 12:14:24 -080016 srcs = [
17 "config_handler.ts",
18 "proxy.ts",
19 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080020 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080021 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080022 deps = [
James Kuszmaul527038a2020-12-21 23:40:44 -080023 ":reflection_ts",
Alex Perryd5e13572020-02-22 15:15:08 -080024 "//aos:configuration_ts_fbs",
Austin Schuha4f69d62020-02-28 13:58:14 -080025 "//aos/network:connect_ts_fbs",
26 "//aos/network:web_proxy_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -070027 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080028 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080029 ],
Alex Perry5f474f22020-02-01 12:14:24 -080030)
31
32ts_library(
33 name = "main",
34 srcs = [
35 "main.ts",
36 "ping_handler.ts",
37 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080038 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -080039 deps = [
40 ":proxy",
41 "//aos/events:ping_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -070042 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perry5f474f22020-02-01 12:14:24 -080043 ],
Alex Perryb3b50792020-01-18 16:13:45 -080044)
45
46rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080047 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070048 entry_point = "main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -080049 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080050 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080051 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070052 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080053 ],
Alex Perryb3b50792020-01-18 16:13:45 -080054)
55
56genrule(
57 name = "flatbuffers",
58 srcs = [
59 "@com_github_google_flatbuffers//:flatjs",
60 ],
61 outs = [
62 "flatbuffers.js",
63 ],
64 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Philipp Schraderdada1072020-11-24 11:34:46 -080065 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080066 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080067)
James Kuszmaulabb77132020-08-01 19:56:16 -070068
69ts_library(
70 name = "reflection_test_main",
71 srcs = [
72 "reflection_test_main.ts",
73 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080074 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -070075 deps = [
76 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080077 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080078 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070079 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080080 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070081 ],
82)
83
84ts_library(
85 name = "reflection_ts",
86 srcs = ["reflection.ts"],
Philipp Schraderdada1072020-11-24 11:34:46 -080087 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070088 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080089 deps = [
90 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080091 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmauldac091f2022-03-22 09:35:06 -070092 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080093 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
94 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070095)
96
James Kuszmaula8f2c452020-07-05 21:17:56 -070097ts_library(
James Kuszmaul933a9742021-03-07 19:59:06 -080098 name = "colors",
99 srcs = [
100 "colors.ts",
101 ],
102 target_compatible_with = ["@platforms//os:linux"],
103 visibility = ["//visibility:public"],
104)
105
106ts_library(
James Kuszmaula8f2c452020-07-05 21:17:56 -0700107 name = "plotter",
108 srcs = [
109 "plotter.ts",
110 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800111 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700112 visibility = ["//visibility:public"],
James Kuszmaul933a9742021-03-07 19:59:06 -0800113 deps = [":colors"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700114)
115
116ts_library(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800117 name = "aos_plotter",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700118 srcs = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800119 "aos_plotter.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700120 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800121 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800122 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700123 deps = [
124 ":plotter",
125 ":proxy",
126 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700127 "//aos:configuration_ts_fbs",
128 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800129 "//aos/network:web_proxy_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -0700130 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700131 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700132 ],
133)
134
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800135ts_library(
136 name = "demo_plot",
137 srcs = [
138 "demo_plot.ts",
139 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800140 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800141 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700142 deps = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800143 ":aos_plotter",
144 ":plotter",
145 ":proxy",
146 ":reflection_ts",
147 "//aos:configuration_ts_fbs",
148 "//aos/network:connect_ts_fbs",
149 "//aos/network:web_proxy_ts_fbs",
150 "//frc971/wpilib:imu_batch_ts_fbs",
151 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700152 ],
153)
154
James Kuszmaulabb77132020-08-01 19:56:16 -0700155aos_config(
156 name = "test_config",
157 src = "test_config_file.json",
158 flatbuffers = [
159 "//aos:configuration_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800160 "//aos:json_to_flatbuffer_fbs",
James Kuszmaulabb77132020-08-01 19:56:16 -0700161 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800162 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800163 visibility = ["//visibility:public"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700164 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800165 "//aos/events:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700166 ],
167)
168
169rollup_bundle(
170 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700171 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800172 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700173 deps = [
174 ":reflection_test_main",
175 ],
176)
177
178sh_binary(
179 name = "web_proxy_demo",
180 srcs = ["web_proxy_demo.sh"],
181 data = [
James Kuszmaulabb77132020-08-01 19:56:16 -0700182 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700183 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700184 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700185 "//aos/network:web_proxy_main",
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800186 "//y2020:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700187 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800188 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700189)