blob: 1caa57cc9997cd7c03c17fc7292668aca588f7f2 [file] [log] [blame]
Austin Schuhda9d0602019-09-15 17:29:38 -07001load("@npm_bazel_typescript//:defs.bzl", "ts_library")
Philipp Schraderdada1072020-11-24 11:34:46 -08002load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "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(
96 name = "plotter",
97 srcs = [
98 "plotter.ts",
99 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800100 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700101 visibility = ["//visibility:public"],
102)
103
104ts_library(
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800105 name = "aos_plotter",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700106 srcs = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800107 "aos_plotter.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700108 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800110 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700111 deps = [
112 ":plotter",
113 ":proxy",
114 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700115 "//aos:configuration_ts_fbs",
116 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800117 "//aos/network:web_proxy_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700118 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700119 ],
120)
121
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800122ts_library(
123 name = "demo_plot",
124 srcs = [
125 "demo_plot.ts",
126 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800127 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800128 visibility = ["//visibility:public"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700129 deps = [
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800130 ":aos_plotter",
131 ":plotter",
132 ":proxy",
133 ":reflection_ts",
134 "//aos:configuration_ts_fbs",
135 "//aos/network:connect_ts_fbs",
136 "//aos/network:web_proxy_ts_fbs",
137 "//frc971/wpilib:imu_batch_ts_fbs",
138 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700139 ],
140)
141
James Kuszmaulabb77132020-08-01 19:56:16 -0700142aos_config(
143 name = "test_config",
144 src = "test_config_file.json",
145 flatbuffers = [
146 "//aos:configuration_fbs",
Brian Silvermanc5105ab2021-02-10 17:55:38 -0800147 "//aos:json_to_flatbuffer_fbs",
James Kuszmaulabb77132020-08-01 19:56:16 -0700148 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800149 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul5f5e1232020-12-22 20:58:00 -0800150 visibility = ["//visibility:public"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700151 deps = [
152 "//aos/events:config",
153 ],
154)
155
156rollup_bundle(
157 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700158 enable_code_splitting = False,
159 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800160 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700161 deps = [
162 ":reflection_test_main",
163 ],
164)
165
166sh_binary(
167 name = "web_proxy_demo",
168 srcs = ["web_proxy_demo.sh"],
169 data = [
James Kuszmaulabb77132020-08-01 19:56:16 -0700170 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700171 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700172 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700173 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700174 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700175 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800176 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700177)