blob: 4b81c71aa61fd70ad8463297bd7eba1926acdc12 [file] [log] [blame]
Primiano Tucci3faad742018-05-16 19:30:48 +01001# Copyright (C) 2018 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("../gn/perfetto.gni")
16import("../gn/wasm.gni")
17import("../protos/perfetto/trace_processor/proto_files.gni")
18
Hector Dearman262cbe22018-05-31 13:28:21 +010019ui_dir = "$root_build_dir/ui"
Hector Dearman21fa9162018-06-22 14:50:29 +010020ui_gen_dir = "$target_out_dir/gen"
Primiano Tucci3faad742018-05-16 19:30:48 +010021nodejs_root = "../buildtools/nodejs"
22nodejs_bin = rebase_path("$nodejs_root/bin", root_build_dir)
23
24# +----------------------------------------------------------------------------+
25# | The outer "ui" target to just ninja -C out/xxx ui |
26# +----------------------------------------------------------------------------+
27group("ui") {
28 deps = [
Michail Schwab20bab202018-08-02 18:17:44 -040029 ":assets_dist",
Primiano Tucci1c752c12018-10-23 09:27:19 +010030 ":catapult_dist",
Hector Dearman81804d12018-07-10 11:38:15 +010031 ":controller_bundle_dist",
32 ":engine_bundle_dist",
33 ":frontend_bundle_dist",
Hector Dearman10641512018-07-04 10:38:53 +010034 ":index_dist",
Primiano Tucci21b91bf2018-08-06 16:42:07 +010035 ":scss",
Hector Dearmanbf384922018-06-25 10:42:01 +010036 ":test_scripts",
Hector Dearman6177b752019-01-24 10:17:32 +000037 ":typefaces_dist",
Hector Dearman10641512018-07-04 10:38:53 +010038 ":wasm_dist",
Primiano Tucci3faad742018-05-16 19:30:48 +010039 ]
40}
41
Hector Dearman4c919612018-12-06 12:32:40 +000042group("query") {
43 deps = [
44 ":query_bundle_dist",
45 ":query_dist",
46 ":ui",
47 ]
48}
49
Primiano Tucci3faad742018-05-16 19:30:48 +010050# +----------------------------------------------------------------------------+
51# | Template used to run node binaries using the hermetic node toolchain. |
52# +----------------------------------------------------------------------------+
53template("node_bin") {
54 action(target_name) {
55 forward_variables_from(invoker,
56 [
57 "inputs",
58 "outputs",
Hector Dearman4274a382018-07-18 16:14:10 +010059 "depfile",
Primiano Tucci3faad742018-05-16 19:30:48 +010060 ])
61 deps = [
62 ":node_modules",
63 ]
64 if (defined(invoker.deps)) {
65 deps += invoker.deps
66 }
67 script = "../gn/standalone/build_tool_wrapper.py"
68 _node_cmd = invoker.node_cmd
Hector Dearmanb06d4152018-05-31 16:55:04 +010069 args = []
70 if (defined(invoker.suppress_stdout) && invoker.suppress_stdout) {
71 args += [ "--suppress_stdout" ]
72 }
73 if (defined(invoker.suppress_stderr) && invoker.suppress_stderr) {
74 args += [ "--suppress_stderr" ]
75 }
76 args += [
77 "--path=$nodejs_bin",
78 "node",
79 rebase_path("node_modules/.bin/$_node_cmd", root_build_dir),
80 ] + invoker.args
Primiano Tucci3faad742018-05-16 19:30:48 +010081 }
82}
83
84# +----------------------------------------------------------------------------+
Hector Dearman92aec392018-06-19 14:33:38 +010085# | Template for "sorcery" the source map resolver. |
86# +----------------------------------------------------------------------------+
87template("sorcery") {
88 node_bin(target_name) {
89 assert(defined(invoker.input))
90 assert(defined(invoker.output))
91 forward_variables_from(invoker, [ "deps" ])
92 inputs = [
93 invoker.input,
94 ]
95 outputs = [
96 invoker.output,
97 invoker.output + ".map",
98 ]
99 node_cmd = "sorcery"
100 args = [
101 "-i",
102 rebase_path(invoker.input, root_build_dir),
103 "-o",
104 rebase_path(invoker.output, root_build_dir),
105 ]
106 }
107}
108
109# +----------------------------------------------------------------------------+
Hector Dearman6999adc2018-06-20 12:07:14 +0100110# | Template for bundling js |
111# +----------------------------------------------------------------------------+
112template("bundle") {
113 node_bin(target_name) {
114 assert(defined(invoker.input))
115 assert(defined(invoker.output))
116 forward_variables_from(invoker, [ "deps" ])
117 inputs = [
118 invoker.input,
119 "rollup.config.js",
120 ]
121 outputs = [
122 invoker.output,
123 invoker.output + ".map",
124 ]
125 node_cmd = "rollup"
126 args = [
127 "-c",
128 rebase_path("rollup.config.js", root_build_dir),
129 rebase_path(invoker.input, root_build_dir),
130 "-o",
131 rebase_path(invoker.output, root_build_dir),
132 "-f",
133 "iife",
134 "-m",
135 "--silent",
136 ]
137 }
138}
139
140# +----------------------------------------------------------------------------+
Primiano Tucci3faad742018-05-16 19:30:48 +0100141# | Bundles all *.js files together resolving CommonJS require() deps. |
142# +----------------------------------------------------------------------------+
143
144# Bundle together all js sources into a bundle.js file, that will ultimately be
145# included by the .html files.
Hector Dearman5f11e522018-05-31 16:54:28 +0100146
Hector Dearman81804d12018-07-10 11:38:15 +0100147bundle("frontend_bundle") {
Primiano Tucci3faad742018-05-16 19:30:48 +0100148 deps = [
149 ":transpile_all_ts",
150 ]
Hector Dearman81804d12018-07-10 11:38:15 +0100151 input = "$target_out_dir/frontend/index.js"
152 output = "$target_out_dir/frontend_bundle.js"
Hector Dearman5f11e522018-05-31 16:54:28 +0100153}
154
Hector Dearman81804d12018-07-10 11:38:15 +0100155bundle("controller_bundle") {
Hector Dearman5f11e522018-05-31 16:54:28 +0100156 deps = [
157 ":transpile_all_ts",
158 ]
Hector Dearman81804d12018-07-10 11:38:15 +0100159 input = "$target_out_dir/controller/index.js"
160 output = "$target_out_dir/controller_bundle.js"
Primiano Tucci3faad742018-05-16 19:30:48 +0100161}
162
Hector Dearman81804d12018-07-10 11:38:15 +0100163bundle("engine_bundle") {
Hector Dearman21fa9162018-06-22 14:50:29 +0100164 deps = [
165 ":transpile_all_ts",
166 ]
Hector Dearman81804d12018-07-10 11:38:15 +0100167 input = "$target_out_dir/engine/index.js"
168 output = "$target_out_dir/engine_bundle.js"
Hector Dearman21fa9162018-06-22 14:50:29 +0100169}
170
Hector Dearman4c919612018-12-06 12:32:40 +0000171bundle("query_bundle") {
172 deps = [
173 ":transpile_all_ts",
174 ]
175 input = "$target_out_dir/query/index.js"
176 output = "$target_out_dir/query_bundle.js"
177}
178
Primiano Tucci3faad742018-05-16 19:30:48 +0100179# +----------------------------------------------------------------------------+
180# | Protobuf: gen rules to create .js and .d.ts files from protos. |
181# +----------------------------------------------------------------------------+
Primiano Tucci3faad742018-05-16 19:30:48 +0100182node_bin("protos_to_js") {
183 inputs = []
184 foreach(proto, trace_processor_protos) {
185 inputs += [ "../protos/perfetto/trace_processor/$proto.proto" ]
186 }
Hector Dearmanf5fd1e12018-06-12 18:23:49 +0100187 inputs += [ "../protos/perfetto/config/perfetto_config.proto" ]
Primiano Tucci3faad742018-05-16 19:30:48 +0100188 outputs = [
Hector Dearman21fa9162018-06-22 14:50:29 +0100189 "$ui_gen_dir/protos.js",
Primiano Tucci3faad742018-05-16 19:30:48 +0100190 ]
191 node_cmd = "pbjs"
192 args = [
193 "-t",
194 "static-module",
195 "-w",
196 "commonjs",
197 "-p",
198 rebase_path("../protos", root_build_dir),
199 "-o",
200 rebase_path(outputs[0], root_build_dir),
201 ] + rebase_path(inputs, root_build_dir)
202}
203
204# Protobuf.js requires to first generate .js files from the .proto and then
205# create .ts definitions for them.
206node_bin("protos_to_ts") {
207 deps = [
208 ":protos_to_js",
209 ]
210 inputs = [
Hector Dearman21fa9162018-06-22 14:50:29 +0100211 "$ui_gen_dir/protos.js",
Primiano Tucci3faad742018-05-16 19:30:48 +0100212 ]
213 outputs = [
Hector Dearman21fa9162018-06-22 14:50:29 +0100214 "$ui_gen_dir/protos.d.ts",
Primiano Tucci3faad742018-05-16 19:30:48 +0100215 ]
216 node_cmd = "pbts"
217 args = [
218 "-p",
219 rebase_path("../protos", root_build_dir),
220 "-o",
221 rebase_path(outputs[0], root_build_dir),
222 rebase_path(inputs[0], root_build_dir),
223 ]
224}
225
226# +----------------------------------------------------------------------------+
227# | TypeScript: transpiles all *.ts into .js |
228# +----------------------------------------------------------------------------+
229
Hector Dearman4274a382018-07-18 16:14:10 +0100230# Builds all .ts sources in the repo under |src|.
Primiano Tucci3faad742018-05-16 19:30:48 +0100231node_bin("transpile_all_ts") {
Primiano Tucci3faad742018-05-16 19:30:48 +0100232 deps = [
233 ":dist_symlink",
234 ":protos_to_ts",
Hector Dearman21fa9162018-06-22 14:50:29 +0100235 ":wasm_gen",
Primiano Tucci3faad742018-05-16 19:30:48 +0100236 ]
Hector Dearman4274a382018-07-18 16:14:10 +0100237 inputs = [
238 "tsconfig.json",
239 ]
Primiano Tucci3faad742018-05-16 19:30:48 +0100240 outputs = [
Hector Dearman81804d12018-07-10 11:38:15 +0100241 "$target_out_dir/frontend/index.js",
242 "$target_out_dir/engine/index.js",
243 "$target_out_dir/controller/index.js",
Hector Dearman4c919612018-12-06 12:32:40 +0000244 "$target_out_dir/query/index.js",
Primiano Tucci3faad742018-05-16 19:30:48 +0100245 ]
246
Hector Dearman4274a382018-07-18 16:14:10 +0100247 depfile = root_out_dir + "/tsc.d"
248 exec_script("../gn/standalone/glob.py",
249 [
250 "--root=" + rebase_path(".", root_build_dir),
251 "--filter=*.ts",
252 "--exclude=node_modules",
253 "--exclude=dist",
254 "--deps=obj/ui/frontend/index.js",
255 "--output=" + rebase_path(depfile),
256 ],
257 "")
258
Primiano Tucci3faad742018-05-16 19:30:48 +0100259 node_cmd = "tsc"
260 args = [
261 "--project",
262 rebase_path(".", root_build_dir),
263 "--outDir",
Hector Dearman262cbe22018-05-31 13:28:21 +0100264 rebase_path(target_out_dir, root_build_dir),
Primiano Tucci3faad742018-05-16 19:30:48 +0100265 ]
266}
267
268# +----------------------------------------------------------------------------+
Primiano Tucci21b91bf2018-08-06 16:42:07 +0100269# | Build css. |
270# +----------------------------------------------------------------------------+
271
Hector Dearmanfcd63bc2018-10-11 11:40:43 +0100272scss_root = "src/assets/perfetto.scss"
273scss_srcs = [
Hector Dearman6177b752019-01-24 10:17:32 +0000274 "src/assets/typefaces.scss",
Hector Dearmanfcd63bc2018-10-11 11:40:43 +0100275 "src/assets/sidebar.scss",
276 "src/assets/topbar.scss",
277 "src/assets/record.scss",
278 "src/assets/common.scss",
279]
280
Primiano Tucci21b91bf2018-08-06 16:42:07 +0100281# Build css.
282node_bin("scss") {
283 deps = [
284 ":dist_symlink",
285 ]
Hector Dearmanfcd63bc2018-10-11 11:40:43 +0100286 inputs = [ scss_root ] + scss_srcs
Primiano Tucci21b91bf2018-08-06 16:42:07 +0100287 outputs = [
288 "$ui_dir/perfetto.css",
289 ]
290
291 node_cmd = "node-sass"
292 args = [
293 "--quiet",
Hector Dearmanfcd63bc2018-10-11 11:40:43 +0100294 rebase_path(scss_root, root_build_dir),
Primiano Tucci21b91bf2018-08-06 16:42:07 +0100295 rebase_path(outputs[0], root_build_dir),
296 ]
297}
298
299# +----------------------------------------------------------------------------+
Hector Dearman262cbe22018-05-31 13:28:21 +0100300# | Copy rules: create the final output directory. |
Primiano Tucci3faad742018-05-16 19:30:48 +0100301# +----------------------------------------------------------------------------+
Hector Dearman10641512018-07-04 10:38:53 +0100302copy("index_dist") {
Primiano Tucci3faad742018-05-16 19:30:48 +0100303 sources = [
304 "index.html",
305 ]
306 outputs = [
Hector Dearman262cbe22018-05-31 13:28:21 +0100307 "$ui_dir/index.html",
Primiano Tucci3faad742018-05-16 19:30:48 +0100308 ]
309}
310
Hector Dearman6177b752019-01-24 10:17:32 +0000311copy("typefaces_dist") {
312 sources = [
313 "../buildtools/typefaces/GoogleSans-Medium.woff2",
314 "../buildtools/typefaces/GoogleSans-Regular.woff2",
315 "../buildtools/typefaces/MaterialIcons.woff2",
316 "../buildtools/typefaces/Raleway-Regular.woff2",
317 "../buildtools/typefaces/Raleway-Thin.woff2",
318 "../buildtools/typefaces/RobotoMono-Regular.woff2",
319 ]
320
321 outputs = [
322 "$ui_dir/assets/{{source_file_part}}",
323 ]
324}
325
Hector Dearman4c919612018-12-06 12:32:40 +0000326copy("query_dist") {
327 sources = [
328 "query.html",
329 ]
330 outputs = [
331 "$ui_dir/query.html",
332 ]
333}
334
Michail Schwab20bab202018-08-02 18:17:44 -0400335copy("assets_dist") {
336 sources = [
Hector Dearmanfcd63bc2018-10-11 11:40:43 +0100337 "src/assets/logo-3d.png",
338 "src/assets/logo.png",
Hector Dearmane97a4992019-02-13 10:49:27 +0000339 "src/assets/rec_atrace.png",
340 "src/assets/rec_battery_counters.png",
341 "src/assets/rec_board_voltage.png",
342 "src/assets/rec_cpu_coarse.png",
343 "src/assets/rec_cpu_fine.png",
344 "src/assets/rec_cpu_freq.png",
345 "src/assets/rec_cpu_voltage.png",
346 "src/assets/rec_cpu_wakeup.png",
347 "src/assets/rec_ftrace.png",
348 "src/assets/rec_lmk.png",
349 "src/assets/rec_logcat.png",
350 "src/assets/rec_long_trace.png",
351 "src/assets/rec_mem_hifreq.png",
352 "src/assets/rec_meminfo.png",
353 "src/assets/rec_one_shot.png",
354 "src/assets/rec_ps_stats.png",
355 "src/assets/rec_ring_buf.png",
356 "src/assets/rec_vmstat.png",
Hector Dearmanfcd63bc2018-10-11 11:40:43 +0100357 ] + [ scss_root ] + scss_srcs
Michail Schwab20bab202018-08-02 18:17:44 -0400358 outputs = [
Hector Dearman7cf6b102018-08-09 17:30:57 +0100359 "$ui_dir/assets/{{source_file_part}}",
Michail Schwab20bab202018-08-02 18:17:44 -0400360 ]
361}
Hector Dearmandaca6cd2018-07-11 12:55:34 +0100362
Hector Dearman81804d12018-07-10 11:38:15 +0100363sorcery("frontend_bundle_dist") {
Hector Dearman262cbe22018-05-31 13:28:21 +0100364 deps = [
Hector Dearman81804d12018-07-10 11:38:15 +0100365 ":frontend_bundle",
Hector Dearman262cbe22018-05-31 13:28:21 +0100366 ]
Hector Dearman81804d12018-07-10 11:38:15 +0100367 input = "$target_out_dir/frontend_bundle.js"
368 output = "$ui_dir/frontend_bundle.js"
Hector Dearman5f11e522018-05-31 16:54:28 +0100369}
370
Hector Dearman81804d12018-07-10 11:38:15 +0100371sorcery("controller_bundle_dist") {
Hector Dearman5f11e522018-05-31 16:54:28 +0100372 deps = [
Hector Dearman81804d12018-07-10 11:38:15 +0100373 ":controller_bundle",
Hector Dearman5f11e522018-05-31 16:54:28 +0100374 ]
Hector Dearman81804d12018-07-10 11:38:15 +0100375 input = "$target_out_dir/controller_bundle.js"
376 output = "$ui_dir/controller_bundle.js"
Hector Dearman262cbe22018-05-31 13:28:21 +0100377}
378
Hector Dearman81804d12018-07-10 11:38:15 +0100379sorcery("engine_bundle_dist") {
Hector Dearman21fa9162018-06-22 14:50:29 +0100380 deps = [
Hector Dearman81804d12018-07-10 11:38:15 +0100381 ":engine_bundle",
Hector Dearman21fa9162018-06-22 14:50:29 +0100382 ]
Hector Dearman81804d12018-07-10 11:38:15 +0100383 input = "$target_out_dir/engine_bundle.js"
384 output = "$ui_dir/engine_bundle.js"
Hector Dearman21fa9162018-06-22 14:50:29 +0100385}
386
Hector Dearman4c919612018-12-06 12:32:40 +0000387sorcery("query_bundle_dist") {
388 deps = [
389 ":query_bundle",
390 ]
391 input = "$target_out_dir/query_bundle.js"
392 output = "$ui_dir/query_bundle.js"
393}
394
Hector Dearman10641512018-07-04 10:38:53 +0100395copy("wasm_dist") {
Primiano Tucci3faad742018-05-16 19:30:48 +0100396 deps = [
Hector Dearmane8450742018-08-31 14:36:51 +0100397 "//src/trace_processor:trace_processor.wasm($wasm_toolchain)",
Primiano Tucci1c752c12018-10-23 09:27:19 +0100398 "//tools/trace_to_text:trace_to_text.wasm($wasm_toolchain)",
Hector Dearman21fa9162018-06-22 14:50:29 +0100399 ]
400 sources = [
Hector Dearmane8450742018-08-31 14:36:51 +0100401 "$root_build_dir/wasm/trace_processor.wasm",
Primiano Tucci1c752c12018-10-23 09:27:19 +0100402 "$root_build_dir/wasm/trace_to_text.wasm",
Hector Dearman21fa9162018-06-22 14:50:29 +0100403 ]
404 outputs = [
405 "$ui_dir/{{source_file_part}}",
406 ]
407}
408
409copy("wasm_gen") {
410 deps = [
411 ":dist_symlink",
Primiano Tucci1c752c12018-10-23 09:27:19 +0100412
413 # trace_processor
Hector Dearmane8450742018-08-31 14:36:51 +0100414 "//src/trace_processor:trace_processor.d.ts($wasm_toolchain)",
415 "//src/trace_processor:trace_processor.js($wasm_toolchain)",
416 "//src/trace_processor:trace_processor.wasm($wasm_toolchain)",
Primiano Tucci1c752c12018-10-23 09:27:19 +0100417
418 # trace_to_text
419 "//tools/trace_to_text:trace_to_text.d.ts($wasm_toolchain)",
420 "//tools/trace_to_text:trace_to_text.js($wasm_toolchain)",
421 "//tools/trace_to_text:trace_to_text.wasm($wasm_toolchain)",
Primiano Tucci3faad742018-05-16 19:30:48 +0100422 ]
423 sources = [
Primiano Tucci1c752c12018-10-23 09:27:19 +0100424 # trace_processor
Hector Dearmane8450742018-08-31 14:36:51 +0100425 "$root_build_dir/wasm/trace_processor.d.ts",
426 "$root_build_dir/wasm/trace_processor.js",
427 "$root_build_dir/wasm/trace_processor.wasm",
Primiano Tucci1c752c12018-10-23 09:27:19 +0100428
429 # trace_to_text
430 "$root_build_dir/wasm/trace_to_text.d.ts",
431 "$root_build_dir/wasm/trace_to_text.js",
432 "$root_build_dir/wasm/trace_to_text.wasm",
Primiano Tucci3faad742018-05-16 19:30:48 +0100433 ]
Hector Dearmana824ba92018-09-19 17:51:25 +0100434 if (is_debug) {
Primiano Tucci1c752c12018-10-23 09:27:19 +0100435 sources += [
436 "$root_build_dir/wasm/trace_processor.wasm.map",
437 "$root_build_dir/wasm/trace_to_text.wasm.map",
438 ]
Hector Dearmana824ba92018-09-19 17:51:25 +0100439 }
Primiano Tucci3faad742018-05-16 19:30:48 +0100440 outputs = [
Hector Dearman21fa9162018-06-22 14:50:29 +0100441 "$ui_gen_dir/{{source_file_part}}",
Primiano Tucci3faad742018-05-16 19:30:48 +0100442 ]
443}
444
Primiano Tucci1c752c12018-10-23 09:27:19 +0100445# Copy over the vulcanized legacy trace viewer.
446copy("catapult_dist") {
447 sources = [
448 "../buildtools/catapult_trace_viewer/catapult_trace_viewer.html",
449 "../buildtools/catapult_trace_viewer/catapult_trace_viewer.js",
450 ]
451 outputs = [
452 "$ui_dir/assets/{{source_file_part}}",
453 ]
454}
455
Primiano Tucci3faad742018-05-16 19:30:48 +0100456# +----------------------------------------------------------------------------+
Deepanjan Royacf8c072018-07-13 11:37:04 -0400457# | Node JS: Creates a symlink in the out directory to node_modules. |
Primiano Tucci3faad742018-05-16 19:30:48 +0100458# +----------------------------------------------------------------------------+
459
460action("check_node_exists") {
461 script = "../gn/standalone/check_buildtool_exists.py"
Hector Dearman48783b12018-05-22 08:26:06 +0100462 args = [
463 nodejs_bin,
464 "--touch",
465 rebase_path("$target_out_dir/node_exists", ""),
466 ]
Primiano Tucci3faad742018-05-16 19:30:48 +0100467 inputs = []
468 outputs = [
Hector Dearman48783b12018-05-22 08:26:06 +0100469 "$target_out_dir/node_exists",
Primiano Tucci3faad742018-05-16 19:30:48 +0100470 ]
471}
472
473# Creates a symlink from out/xxx/ui/node_modules -> ../../../ui/node_modules.
Hector Dearmanb06d4152018-05-31 16:55:04 +0100474# This allows to run rollup and other node tools from the out/xxx directory.
Primiano Tucci3faad742018-05-16 19:30:48 +0100475action("node_modules_symlink") {
476 deps = [
477 ":check_node_exists",
478 ]
Hector Dearman6186c872018-05-31 13:28:48 +0100479
Primiano Tucci3faad742018-05-16 19:30:48 +0100480 script = "../gn/standalone/build_tool_wrapper.py"
Hector Dearman6186c872018-05-31 13:28:48 +0100481 stamp_file = "$target_out_dir/.$target_name.stamp"
Primiano Tucci3faad742018-05-16 19:30:48 +0100482 args = [
Hector Dearman6186c872018-05-31 13:28:48 +0100483 "--stamp",
484 rebase_path(stamp_file, root_build_dir),
Primiano Tucci3faad742018-05-16 19:30:48 +0100485 "/bin/ln",
486 "-fns",
Hector Dearmana817a062018-06-01 11:01:07 +0100487 rebase_path("node_modules", target_out_dir),
Hector Dearman6186c872018-05-31 13:28:48 +0100488 rebase_path("$target_out_dir/node_modules", root_build_dir),
489 ]
490 outputs = [
491 stamp_file,
Primiano Tucci3faad742018-05-16 19:30:48 +0100492 ]
493}
494
Hector Dearman6186c872018-05-31 13:28:48 +0100495group("node_modules") {
Primiano Tucci3faad742018-05-16 19:30:48 +0100496 deps = [
497 ":node_modules_symlink",
498 ]
499}
500
501# Creates a symlink from //ui/dist -> ../../out/xxx/ui. Used only for
502# autocompletion in IDEs. The problem this is solving is that in tsconfig.json
503# we can't possibly know the path to ../../out/xxx for outDir. Instead, we set
504# outDir to "./dist" and create a symlink on the first build.
505action("dist_symlink") {
506 script = "../gn/standalone/build_tool_wrapper.py"
Hector Dearman262cbe22018-05-31 13:28:21 +0100507 stamp_file = "$target_out_dir/.$target_name.stamp"
Primiano Tucci3faad742018-05-16 19:30:48 +0100508 args = [
509 "--stamp",
510 rebase_path(stamp_file, root_build_dir),
511 "/bin/ln",
512 "-fns",
Hector Dearman262cbe22018-05-31 13:28:21 +0100513 rebase_path(target_out_dir, "."),
Primiano Tucci3faad742018-05-16 19:30:48 +0100514 rebase_path("dist", root_build_dir),
515 ]
516 inputs = [
517 "$root_build_dir",
518 ]
519 outputs = [
520 stamp_file,
521 ]
522}
Hector Dearmanbf384922018-06-25 10:42:01 +0100523
524group("test_scripts") {
525 deps = [
526 ":copy_tests_script",
527 ":copy_unittests_script",
528 ]
529}
530
531copy("copy_unittests_script") {
532 sources = [
533 "config/ui_unittests_template",
534 ]
535 outputs = [
536 "$root_build_dir/ui_unittests",
537 ]
538}
539
540copy("copy_tests_script") {
541 sources = [
542 "config/ui_tests_template",
543 ]
544 outputs = [
545 "$root_build_dir/ui_tests",
546 ]
547}