blob: 1b00af7826de99fddc57bfa4c84f0fbe2c3188e2 [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",
Philipp Schradere625ba22020-11-16 20:11:37 -080027 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080028 ],
Alex Perry5f474f22020-02-01 12:14:24 -080029)
30
31ts_library(
32 name = "main",
33 srcs = [
34 "main.ts",
35 "ping_handler.ts",
36 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080037 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -080038 deps = [
39 ":proxy",
40 "//aos/events:ping_ts_fbs",
41 ],
Alex Perryb3b50792020-01-18 16:13:45 -080042)
43
44rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080045 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070046 entry_point = "main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080048 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080049 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070050 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080051 ],
Alex Perryb3b50792020-01-18 16:13:45 -080052)
53
54genrule(
55 name = "flatbuffers",
56 srcs = [
57 "@com_github_google_flatbuffers//:flatjs",
58 ],
59 outs = [
60 "flatbuffers.js",
61 ],
62 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Philipp Schraderdada1072020-11-24 11:34:46 -080063 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080064 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080065)
James Kuszmaulabb77132020-08-01 19:56:16 -070066
67ts_library(
68 name = "reflection_test_main",
69 srcs = [
70 "reflection_test_main.ts",
71 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080072 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -070073 deps = [
74 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080075 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080076 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070077 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080078 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070079 ],
80)
81
82ts_library(
83 name = "reflection_ts",
84 srcs = ["reflection.ts"],
Philipp Schraderdada1072020-11-24 11:34:46 -080085 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070086 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080087 deps = [
88 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080089 "//aos:json_to_flatbuffer_fbs_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080090 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
91 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070092)
93
James Kuszmaula8f2c452020-07-05 21:17:56 -070094ts_library(
James Kuszmaul933a9742021-03-07 19:59:06 -080095 name = "colors",
96 srcs = [
97 "colors.ts",
98 ],
99 target_compatible_with = ["@platforms//os:linux"],
100 visibility = ["//visibility:public"],
101)
102
103ts_library(
James Kuszmaula8f2c452020-07-05 21:17:56 -0700104 name = "plotter",
105 srcs = [
106 "plotter.ts",
107 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800108 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700109 visibility = ["//visibility:public"],
James Kuszmaul933a9742021-03-07 19:59:06 -0800110 deps = [":colors"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700111)
112
113ts_library(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800114 name = "aos_plotter",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700115 srcs = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800116 "aos_plotter.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700117 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800118 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800119 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700120 deps = [
121 ":plotter",
122 ":proxy",
123 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700124 "//aos:configuration_ts_fbs",
125 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800126 "//aos/network:web_proxy_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700127 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700128 ],
129)
130
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800131ts_library(
132 name = "demo_plot",
133 srcs = [
134 "demo_plot.ts",
135 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800136 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800137 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700138 deps = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800139 ":aos_plotter",
140 ":plotter",
141 ":proxy",
142 ":reflection_ts",
143 "//aos:configuration_ts_fbs",
144 "//aos/network:connect_ts_fbs",
145 "//aos/network:web_proxy_ts_fbs",
146 "//frc971/wpilib:imu_batch_ts_fbs",
147 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700148 ],
149)
150
James Kuszmaulabb77132020-08-01 19:56:16 -0700151aos_config(
152 name = "test_config",
153 src = "test_config_file.json",
154 flatbuffers = [
155 "//aos:configuration_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800156 "//aos:json_to_flatbuffer_fbs",
James Kuszmaulabb77132020-08-01 19:56:16 -0700157 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800158 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800159 visibility = ["//visibility:public"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700160 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800161 "//aos/events:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700162 ],
163)
164
165rollup_bundle(
166 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700167 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800168 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700169 deps = [
170 ":reflection_test_main",
171 ],
172)
173
174sh_binary(
175 name = "web_proxy_demo",
176 srcs = ["web_proxy_demo.sh"],
177 data = [
James Kuszmaulabb77132020-08-01 19:56:16 -0700178 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700179 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700180 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700181 "//aos/network:web_proxy_main",
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800182 "//y2020:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700183 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800184 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700185)