blob: 03f41a59a34ed611ad5128f920cf8c32a0c1662a [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
Austin Schuhfcd56942022-07-18 17:41:32 -07005exports_files(["styles.css"])
6
Alex Perryb3b50792020-01-18 16:13:45 -08007filegroup(
8 name = "files",
9 srcs = glob([
10 "**/*.html",
Alex Perry5f474f22020-02-01 12:14:24 -080011 "**/*.css",
Alex Perryb3b50792020-01-18 16:13:45 -080012 ]),
Austin Schuha4f69d62020-02-28 13:58:14 -080013 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080014)
15
16ts_library(
17 name = "proxy",
Alex Perry5f474f22020-02-01 12:14:24 -080018 srcs = [
19 "config_handler.ts",
20 "proxy.ts",
21 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080022 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080023 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080024 deps = [
James Kuszmaul527038a2020-12-21 23:40:44 -080025 ":reflection_ts",
Alex Perryd5e13572020-02-22 15:15:08 -080026 "//aos:configuration_ts_fbs",
Austin Schuha4f69d62020-02-28 13:58:14 -080027 "//aos/network:connect_ts_fbs",
28 "//aos/network:web_proxy_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -070029 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080030 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080031 ],
Alex Perry5f474f22020-02-01 12:14:24 -080032)
33
34ts_library(
35 name = "main",
36 srcs = [
37 "main.ts",
38 "ping_handler.ts",
39 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080040 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -080041 deps = [
42 ":proxy",
43 "//aos/events:ping_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -070044 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perry5f474f22020-02-01 12:14:24 -080045 ],
Alex Perryb3b50792020-01-18 16:13:45 -080046)
47
48rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080049 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070050 entry_point = "main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -080051 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080052 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080053 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070054 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080055 ],
Alex Perryb3b50792020-01-18 16:13:45 -080056)
57
58genrule(
59 name = "flatbuffers",
60 srcs = [
61 "@com_github_google_flatbuffers//:flatjs",
62 ],
63 outs = [
64 "flatbuffers.js",
65 ],
66 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Philipp Schraderdada1072020-11-24 11:34:46 -080067 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha4f69d62020-02-28 13:58:14 -080068 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080069)
James Kuszmaulabb77132020-08-01 19:56:16 -070070
71ts_library(
72 name = "reflection_test_main",
73 srcs = [
74 "reflection_test_main.ts",
75 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080076 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -070077 deps = [
78 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080079 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080080 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070081 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080082 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070083 ],
84)
85
86ts_library(
87 name = "reflection_ts",
88 srcs = ["reflection.ts"],
Philipp Schraderdada1072020-11-24 11:34:46 -080089 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070090 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080091 deps = [
92 "//aos:configuration_ts_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -080093 "//aos:json_to_flatbuffer_fbs_ts",
James Kuszmauldac091f2022-03-22 09:35:06 -070094 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080095 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
96 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070097)
98
James Kuszmaula8f2c452020-07-05 21:17:56 -070099ts_library(
James Kuszmaul933a9742021-03-07 19:59:06 -0800100 name = "colors",
101 srcs = [
102 "colors.ts",
103 ],
104 target_compatible_with = ["@platforms//os:linux"],
105 visibility = ["//visibility:public"],
106)
107
108ts_library(
James Kuszmaula8f2c452020-07-05 21:17:56 -0700109 name = "plotter",
110 srcs = [
111 "plotter.ts",
112 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800113 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700114 visibility = ["//visibility:public"],
James Kuszmaul933a9742021-03-07 19:59:06 -0800115 deps = [":colors"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700116)
117
118ts_library(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800119 name = "aos_plotter",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700120 srcs = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800121 "aos_plotter.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700122 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800123 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800124 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700125 deps = [
126 ":plotter",
127 ":proxy",
128 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700129 "//aos:configuration_ts_fbs",
130 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800131 "//aos/network:web_proxy_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -0700132 "@com_github_google_flatbuffers//reflection:reflection_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700133 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700134 ],
135)
136
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800137ts_library(
138 name = "demo_plot",
139 srcs = [
140 "demo_plot.ts",
141 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800142 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800143 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700144 deps = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800145 ":aos_plotter",
146 ":plotter",
147 ":proxy",
148 ":reflection_ts",
149 "//aos:configuration_ts_fbs",
150 "//aos/network:connect_ts_fbs",
151 "//aos/network:web_proxy_ts_fbs",
152 "//frc971/wpilib:imu_batch_ts_fbs",
153 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700154 ],
155)
156
James Kuszmaulabb77132020-08-01 19:56:16 -0700157aos_config(
158 name = "test_config",
159 src = "test_config_file.json",
160 flatbuffers = [
161 "//aos:configuration_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800162 "//aos:json_to_flatbuffer_fbs",
James Kuszmaulabb77132020-08-01 19:56:16 -0700163 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800164 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800165 visibility = ["//visibility:public"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700166 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800167 "//aos/events:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700168 ],
169)
170
171rollup_bundle(
172 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700173 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800174 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700175 deps = [
176 ":reflection_test_main",
177 ],
178)
179
180sh_binary(
181 name = "web_proxy_demo",
182 srcs = ["web_proxy_demo.sh"],
183 data = [
James Kuszmaulabb77132020-08-01 19:56:16 -0700184 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700185 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700186 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700187 "//aos/network:web_proxy_main",
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800188 "//y2020:aos_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700189 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800190 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700191)