blob: 03e269d63d6db81226b7d0fdeabe045fae049d5e [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 = [
Alex Perryd5e13572020-02-22 15:15:08 -080023 "//aos:configuration_ts_fbs",
Austin Schuha4f69d62020-02-28 13:58:14 -080024 "//aos/network:connect_ts_fbs",
25 "//aos/network:web_proxy_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080026 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080027 ],
Alex Perry5f474f22020-02-01 12:14:24 -080028)
29
30ts_library(
31 name = "main",
32 srcs = [
33 "main.ts",
34 "ping_handler.ts",
35 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080036 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -080037 deps = [
38 ":proxy",
39 "//aos/events:ping_ts_fbs",
40 ],
Alex Perryb3b50792020-01-18 16:13:45 -080041)
42
43rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080044 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070045 enable_code_splitting = False,
46 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",
76 "//aos:json_to_flatbuffer_flatbuffer_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",
89 "//aos:json_to_flatbuffer_flatbuffer_ts",
90 "@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(
95 name = "plotter",
96 srcs = [
97 "plotter.ts",
98 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080099 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700100 visibility = ["//visibility:public"],
101)
102
103ts_library(
104 name = "graph_main",
105 srcs = [
106 "graph_main.ts",
107 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800108 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700109 deps = [
110 ":plotter",
111 ":proxy",
112 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700113 "//aos:configuration_ts_fbs",
114 "//aos/network:connect_ts_fbs",
James Kuszmaul71a81932020-12-15 21:08:01 -0800115 "//aos/network:web_proxy_ts_fbs",
Austin Schuhda9d0602019-09-15 17:29:38 -0700116 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700117 ],
118)
119
120rollup_bundle(
121 name = "graph_main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700122 enable_code_splitting = False,
123 entry_point = "graph_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800124 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaula8f2c452020-07-05 21:17:56 -0700125 deps = [
126 ":graph_main",
127 ],
128)
129
James Kuszmaulabb77132020-08-01 19:56:16 -0700130aos_config(
131 name = "test_config",
132 src = "test_config_file.json",
133 flatbuffers = [
134 "//aos:configuration_fbs",
135 "//aos:json_to_flatbuffer_flatbuffer",
136 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800137 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700138 deps = [
139 "//aos/events:config",
140 ],
141)
142
143rollup_bundle(
144 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700145 enable_code_splitting = False,
146 entry_point = "reflection_test_main.ts",
Philipp Schraderdada1072020-11-24 11:34:46 -0800147 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700148 deps = [
149 ":reflection_test_main",
150 ],
151)
152
153sh_binary(
154 name = "web_proxy_demo",
155 srcs = ["web_proxy_demo.sh"],
156 data = [
James Kuszmaula8f2c452020-07-05 21:17:56 -0700157 ":graph.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700158 ":graph_main_bundle.min.js",
James Kuszmaulabb77132020-08-01 19:56:16 -0700159 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700160 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700161 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700162 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700163 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700164 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800165 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulabb77132020-08-01 19:56:16 -0700166)
James Kuszmaul71a81932020-12-15 21:08:01 -0800167
168filegroup(
169 name = "plotting_sample",
170 srcs = [
171 "graph.html",
172 "graph_main_bundle.min.js",
173 "styles.css",
174 "test_config",
175 ],
176 visibility = ["//visibility:public"],
177)