blob: 8f5bd4917b92116cc5d9805a3bc0228fc63b4752 [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",
77 "//aos:json_to_flatbuffer_flatbuffer_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",
90 "//aos:json_to_flatbuffer_flatbuffer_ts",
91 "@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(
105 name = "graph_main",
106 srcs = [
107 "graph_main.ts",
108 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800109 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700110 deps = [
111 ":plotter",
112 ":proxy",
113 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700114 "//aos:configuration_ts_fbs",
115 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800116 "//aos/network:web_proxy_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700117 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700118 ],
119)
120
121rollup_bundle(
122 name = "graph_main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700123 enable_code_splitting = False,
124 entry_point = "graph_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800125 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700126 deps = [
127 ":graph_main",
128 ],
129)
130
James Kuszmaulabb77132020-08-01 19:56:16 -0700131aos_config(
132 name = "test_config",
133 src = "test_config_file.json",
134 flatbuffers = [
135 "//aos:configuration_fbs",
136 "//aos:json_to_flatbuffer_flatbuffer",
137 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800138 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700139 deps = [
140 "//aos/events:config",
141 ],
142)
143
144rollup_bundle(
145 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700146 enable_code_splitting = False,
147 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800148 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700149 deps = [
150 ":reflection_test_main",
151 ],
152)
153
154sh_binary(
155 name = "web_proxy_demo",
156 srcs = ["web_proxy_demo.sh"],
157 data = [
James Kuszmaula8f2c452020-07-05 21:17:56 -0700158 ":graph.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700159 ":graph_main_bundle.min.js",
James Kuszmaulabb77132020-08-01 19:56:16 -0700160 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700161 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700162 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700163 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700164 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700165 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800166 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700167)
James Kuszmaul71a81932020-12-15 21:08:01 -0800168
169filegroup(
170 name = "plotting_sample",
171 srcs = [
172 "graph.html",
173 "graph_main_bundle.min.js",
174 "styles.css",
175 "test_config",
176 ],
177 visibility = ["//visibility:public"],
178)