blob: 7ec26cc80f4a35d2061c9ab9cc8106057d087973 [file] [log] [blame]
Alex Perryb3b50792020-01-18 16:13:45 -08001load("@build_bazel_rules_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",
Alex Perryb3b50792020-01-18 16:13:45 -080043 entry_point = "aos/network/www/main",
Austin Schuha4f69d62020-02-28 13:58:14 -080044 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080045 deps = [
Alex Perry5f474f22020-02-01 12:14:24 -080046 "main",
Alex Perryb3b50792020-01-18 16:13:45 -080047 ],
Alex Perryb3b50792020-01-18 16:13:45 -080048)
49
50genrule(
51 name = "flatbuffers",
52 srcs = [
53 "@com_github_google_flatbuffers//:flatjs",
54 ],
55 outs = [
56 "flatbuffers.js",
57 ],
58 cmd = "cp $(location @com_github_google_flatbuffers//:flatjs) $@",
Austin Schuha4f69d62020-02-28 13:58:14 -080059 visibility = ["//aos:__subpackages__"],
Alex Perryb3b50792020-01-18 16:13:45 -080060)
James Kuszmaulabb77132020-08-01 19:56:16 -070061
62ts_library(
63 name = "reflection_test_main",
64 srcs = [
65 "reflection_test_main.ts",
66 ],
67 deps = [
68 ":reflection_ts",
Philipp Schradere625ba22020-11-16 20:11:37 -080069 "//aos:configuration_ts_fbs",
70 "//aos:json_to_flatbuffer_flatbuffer_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070071 "//aos/network/www:proxy",
Philipp Schradere625ba22020-11-16 20:11:37 -080072 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
James Kuszmaulabb77132020-08-01 19:56:16 -070073 ],
74)
75
76ts_library(
77 name = "reflection_ts",
78 srcs = ["reflection.ts"],
James Kuszmaula8f2c452020-07-05 21:17:56 -070079 visibility = ["//visibility:public"],
Philipp Schradere625ba22020-11-16 20:11:37 -080080 deps = [
81 "//aos:configuration_ts_fbs",
82 "//aos:json_to_flatbuffer_flatbuffer_ts",
83 "@com_github_google_flatbuffers//ts:flatbuffers_ts",
84 ],
James Kuszmaulabb77132020-08-01 19:56:16 -070085)
86
James Kuszmaula8f2c452020-07-05 21:17:56 -070087ts_library(
88 name = "plotter",
89 srcs = [
90 "plotter.ts",
91 ],
92 visibility = ["//visibility:public"],
93)
94
95ts_library(
96 name = "graph_main",
97 srcs = [
98 "graph_main.ts",
99 ],
100 deps = [
101 ":plotter",
102 ":proxy",
103 ":reflection_ts",
104 ],
105)
106
107rollup_bundle(
108 name = "graph_main_bundle",
109 entry_point = "aos/network/www/graph_main",
110 deps = [
111 ":graph_main",
112 ],
113)
114
James Kuszmaulabb77132020-08-01 19:56:16 -0700115aos_config(
116 name = "test_config",
117 src = "test_config_file.json",
118 flatbuffers = [
119 "//aos:configuration_fbs",
120 "//aos:json_to_flatbuffer_flatbuffer",
121 ],
122 deps = [
123 "//aos/events:config",
124 ],
125)
126
127rollup_bundle(
128 name = "reflection_test_bundle",
129 entry_point = "aos/network/www/reflection_test_main",
130 deps = [
131 ":reflection_test_main",
132 ],
133)
134
135sh_binary(
136 name = "web_proxy_demo",
137 srcs = ["web_proxy_demo.sh"],
138 data = [
139 ":flatbuffers",
James Kuszmaula8f2c452020-07-05 21:17:56 -0700140 ":graph.html",
141 ":graph_main_bundle",
James Kuszmaulabb77132020-08-01 19:56:16 -0700142 ":reflection_test.html",
143 ":reflection_test_bundle",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700144 ":test_config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700145 "//aos/network:web_proxy_main",
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700146 "//y2020:config",
James Kuszmaulabb77132020-08-01 19:56:16 -0700147 ],
148)