blob: 64d74527640dc50afaa20e9e6242461a392a0405 [file] [log] [blame]
Austin Schuhda9d0602019-09-15 17:29:38 -07001load("@npm_bazel_typescript//:defs.bzl", "ts_library")
Philipp Schradercc016b32021-12-30 08:59:58 -08002load("@build_bazel_rules_nodejs//:defs.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 enable_code_splitting = False,
47 entry_point = "main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -080048 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080049 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080050 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070051 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080052 ],
Alex Perryb3b50792020-01-18 16:13:45 -080053)
54
55genrule(
56 name = "flatbuffers",
57 srcs = [
58 "@com_github_google_flatbuffers//:flatjs",
59 ],
60 outs = [
61 "flatbuffers.js",
62 ],
63 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Philipp Schraderdada1072020-11-24 11:34:46 -080064 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080065 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080066)
James Kuszmaulabb77132020-08-01 19:56:16 -070067
68ts_library(
69 name = "reflection_test_main",
70 srcs = [
71 "reflection_test_main.ts",
72 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080073 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -070074 deps = [
75 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080076 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080077 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070078 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080079 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070080 ],
81)
82
83ts_library(
84 name = "reflection_ts",
85 srcs = ["reflection.ts"],
Philipp Schraderdada1072020-11-24 11:34:46 -080086 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070087 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080088 deps = [
89 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080090 "//aos:json_to_flatbuffer_fbs_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080091 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
92 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070093)
94
James Kuszmaula8f2c452020-07-05 21:17:56 -070095ts_library(
James Kuszmaul933a9742021-03-07 19:59:06 -080096 name = "colors",
97 srcs = [
98 "colors.ts",
99 ],
100 target_compatible_with = ["@platforms//os:linux"],
101 visibility = ["//visibility:public"],
102)
103
104ts_library(
James Kuszmaula8f2c452020-07-05 21:17:56 -0700105 name = "plotter",
106 srcs = [
107 "plotter.ts",
108 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700110 visibility = ["//visibility:public"],
James Kuszmaul933a9742021-03-07 19:59:06 -0800111 deps = [":colors"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700112)
113
114ts_library(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800115 name = "aos_plotter",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700116 srcs = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800117 "aos_plotter.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700118 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800119 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800120 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700121 deps = [
122 ":plotter",
123 ":proxy",
124 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700125 "//aos:configuration_ts_fbs",
126 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800127 "//aos/network:web_proxy_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700128 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700129 ],
130)
131
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800132ts_library(
133 name = "demo_plot",
134 srcs = [
135 "demo_plot.ts",
136 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800137 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800138 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700139 deps = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800140 ":aos_plotter",
141 ":plotter",
142 ":proxy",
143 ":reflection_ts",
144 "//aos:configuration_ts_fbs",
145 "//aos/network:connect_ts_fbs",
146 "//aos/network:web_proxy_ts_fbs",
147 "//frc971/wpilib:imu_batch_ts_fbs",
148 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700149 ],
150)
151
James Kuszmaulabb77132020-08-01 19:56:16 -0700152aos_config(
153 name = "test_config",
154 src = "test_config_file.json",
155 flatbuffers = [
156 "//aos:configuration_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800157 "//aos:json_to_flatbuffer_fbs",
James Kuszmaulabb77132020-08-01 19:56:16 -0700158 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800159 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800160 visibility = ["//visibility:public"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700161 deps = [
162 "//aos/events:config",
163 ],
164)
165
166rollup_bundle(
167 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700168 enable_code_splitting = False,
169 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800170 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700171 deps = [
172 ":reflection_test_main",
173 ],
174)
175
176sh_binary(
177 name = "web_proxy_demo",
178 srcs = ["web_proxy_demo.sh"],
179 data = [
James Kuszmaulabb77132020-08-01 19:56:16 -0700180 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700181 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700182 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700183 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700184 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700185 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800186 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700187)