blob: 4987a30e4fb346f45d68594317748f6db0ecb585 [file] [log] [blame]
Austin Schuhda9d0602019-09-15 17:29:38 -07001load("@npm_bazel_typescript//:defs.bzl", "ts_library")
James Kuszmaulabb77132020-08-01 19:56:16 -07002load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "nodejs_binary")
3load("//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 ],
Austin Schuha4f69d62020-02-28 13:58:14 -080020 visibility = ["//visibility:public"],
Alex Perryb3b50792020-01-18 16:13:45 -080021 deps = [
Alex Perryd5e13572020-02-22 15:15:08 -080022 "//aos:configuration_ts_fbs",
Austin Schuha4f69d62020-02-28 13:58:14 -080023 "//aos/network:connect_ts_fbs",
24 "//aos/network:web_proxy_ts_fbs",
Philipp Schradere625ba22020-11-16 20:11:37 -080025 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
Alex Perryb3b50792020-01-18 16:13:45 -080026 ],
Alex Perry5f474f22020-02-01 12:14:24 -080027)
28
29ts_library(
30 name = "main",
31 srcs = [
32 "main.ts",
33 "ping_handler.ts",
34 ],
35 deps = [
36 ":proxy",
37 "//aos/events:ping_ts_fbs",
38 ],
Alex Perryb3b50792020-01-18 16:13:45 -080039)
40
41rollup_bundle(
Alex Perry5f474f22020-02-01 12:14:24 -080042 name = "main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -070043 enable_code_splitting = False,
44 entry_point = "main.ts",
Austin Schuha4f69d62020-02-28 13:58:14 -080045 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080046 deps = [
Austin Schuhda9d0602019-09-15 17:29:38 -070047 ":main",
Alex Perryb3b50792020-01-18 16:13:45 -080048 ],
Alex Perryb3b50792020-01-18 16:13:45 -080049)
50
51genrule(
52 name = "flatbuffers",
53 srcs = [
54 "@com_github_google_flatbuffers//:flatjs",
55 ],
56 outs = [
57 "flatbuffers.js",
58 ],
59 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Austin Schuha4f69d62020-02-28 13:58:14 -080060 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080061)
James Kuszmaulabb77132020-08-01 19:56:16 -070062
63ts_library(
64 name = "reflection_test_main",
65 srcs = [
66 "reflection_test_main.ts",
67 ],
68 deps = [
69 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080070 "//aos:configuration_ts_fbs",
71 "//aos:json_to_flatbuffer_flatbuffer_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070072 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080073 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070074 ],
75)
76
77ts_library(
78 name = "reflection_ts",
79 srcs = ["reflection.ts"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070080 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080081 deps = [
82 "//aos:configuration_ts_fbs",
83 "//aos:json_to_flatbuffer_flatbuffer_ts",
84 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
85 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070086)
87
James Kuszmaula8f2c452020-07-05 21:17:56 -070088ts_library(
89 name = "plotter",
90 srcs = [
91 "plotter.ts",
92 ],
93 visibility = ["//visibility:public"],
94)
95
96ts_library(
97 name = "graph_main",
98 srcs = [
99 "graph_main.ts",
100 ],
101 deps = [
102 ":plotter",
103 ":proxy",
104 ":reflection_ts",
Austin Schuhda9d0602019-09-15 17:29:38 -0700105 "//aos:configuration_ts_fbs",
106 "//aos/network:connect_ts_fbs",
107 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700108 ],
109)
110
111rollup_bundle(
112 name = "graph_main_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700113 enable_code_splitting = False,
114 entry_point = "graph_main.ts",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700115 deps = [
116 ":graph_main",
117 ],
118)
119
James Kuszmaulabb77132020-08-01 19:56:16 -0700120aos_config(
121 name = "test_config",
122 src = "test_config_file.json",
123 flatbuffers = [
124 "//aos:configuration_fbs",
125 "//aos:json_to_flatbuffer_flatbuffer",
126 ],
127 deps = [
128 "//aos/events:config",
129 ],
130)
131
132rollup_bundle(
133 name = "reflection_test_bundle",
Austin Schuhda9d0602019-09-15 17:29:38 -0700134 enable_code_splitting = False,
135 entry_point = "reflection_test_main.ts",
James Kuszmaulabb77132020-08-01 19:56:16 -0700136 deps = [
137 ":reflection_test_main",
138 ],
139)
140
141sh_binary(
142 name = "web_proxy_demo",
143 srcs = ["web_proxy_demo.sh"],
144 data = [
James Kuszmaula8f2c452020-07-05 21:17:56 -0700145 ":graph.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700146 ":graph_main_bundle.min.js",
James Kuszmaulabb77132020-08-01 19:56:16 -0700147 ":reflection_test.html",
Austin Schuhda9d0602019-09-15 17:29:38 -0700148 ":reflection_test_bundle.min.js",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700149 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700150 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700151 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700152 ],
153)