Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 1 | # 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 | |
| 15 | import("../gn/perfetto.gni") |
| 16 | import("../gn/wasm.gni") |
| 17 | import("../protos/perfetto/trace_processor/proto_files.gni") |
| 18 | |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 19 | ui_dir = "$root_build_dir/ui" |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 20 | ui_gen_dir = "$target_out_dir/gen" |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 21 | nodejs_root = "../buildtools/nodejs" |
| 22 | nodejs_bin = rebase_path("$nodejs_root/bin", root_build_dir) |
| 23 | |
| 24 | # +----------------------------------------------------------------------------+ |
| 25 | # | The outer "ui" target to just ninja -C out/xxx ui | |
| 26 | # +----------------------------------------------------------------------------+ |
| 27 | group("ui") { |
| 28 | deps = [ |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 29 | ":controller_bundle_dist", |
Hector Dearman | daca6cd | 2018-07-11 12:55:34 +0100 | [diff] [blame] | 30 | ":css_dist", |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 31 | ":engine_bundle_dist", |
| 32 | ":frontend_bundle_dist", |
Hector Dearman | 1064151 | 2018-07-04 10:38:53 +0100 | [diff] [blame] | 33 | ":index_dist", |
Hector Dearman | bf38492 | 2018-06-25 10:42:01 +0100 | [diff] [blame] | 34 | ":test_scripts", |
Hector Dearman | 1064151 | 2018-07-04 10:38:53 +0100 | [diff] [blame] | 35 | ":wasm_dist", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 36 | ] |
| 37 | } |
| 38 | |
| 39 | # +----------------------------------------------------------------------------+ |
| 40 | # | Template used to run node binaries using the hermetic node toolchain. | |
| 41 | # +----------------------------------------------------------------------------+ |
| 42 | template("node_bin") { |
| 43 | action(target_name) { |
| 44 | forward_variables_from(invoker, |
| 45 | [ |
| 46 | "inputs", |
| 47 | "outputs", |
| 48 | ]) |
| 49 | deps = [ |
| 50 | ":node_modules", |
| 51 | ] |
| 52 | if (defined(invoker.deps)) { |
| 53 | deps += invoker.deps |
| 54 | } |
| 55 | script = "../gn/standalone/build_tool_wrapper.py" |
| 56 | _node_cmd = invoker.node_cmd |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 57 | args = [] |
| 58 | if (defined(invoker.suppress_stdout) && invoker.suppress_stdout) { |
| 59 | args += [ "--suppress_stdout" ] |
| 60 | } |
| 61 | if (defined(invoker.suppress_stderr) && invoker.suppress_stderr) { |
| 62 | args += [ "--suppress_stderr" ] |
| 63 | } |
| 64 | args += [ |
| 65 | "--path=$nodejs_bin", |
| 66 | "node", |
| 67 | rebase_path("node_modules/.bin/$_node_cmd", root_build_dir), |
| 68 | ] + invoker.args |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 69 | } |
| 70 | } |
| 71 | |
| 72 | # +----------------------------------------------------------------------------+ |
Hector Dearman | 92aec39 | 2018-06-19 14:33:38 +0100 | [diff] [blame] | 73 | # | Template for "sorcery" the source map resolver. | |
| 74 | # +----------------------------------------------------------------------------+ |
| 75 | template("sorcery") { |
| 76 | node_bin(target_name) { |
| 77 | assert(defined(invoker.input)) |
| 78 | assert(defined(invoker.output)) |
| 79 | forward_variables_from(invoker, [ "deps" ]) |
| 80 | inputs = [ |
| 81 | invoker.input, |
| 82 | ] |
| 83 | outputs = [ |
| 84 | invoker.output, |
| 85 | invoker.output + ".map", |
| 86 | ] |
| 87 | node_cmd = "sorcery" |
| 88 | args = [ |
| 89 | "-i", |
| 90 | rebase_path(invoker.input, root_build_dir), |
| 91 | "-o", |
| 92 | rebase_path(invoker.output, root_build_dir), |
| 93 | ] |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | # +----------------------------------------------------------------------------+ |
Hector Dearman | 6999adc | 2018-06-20 12:07:14 +0100 | [diff] [blame] | 98 | # | Template for bundling js | |
| 99 | # +----------------------------------------------------------------------------+ |
| 100 | template("bundle") { |
| 101 | node_bin(target_name) { |
| 102 | assert(defined(invoker.input)) |
| 103 | assert(defined(invoker.output)) |
| 104 | forward_variables_from(invoker, [ "deps" ]) |
| 105 | inputs = [ |
| 106 | invoker.input, |
| 107 | "rollup.config.js", |
| 108 | ] |
| 109 | outputs = [ |
| 110 | invoker.output, |
| 111 | invoker.output + ".map", |
| 112 | ] |
| 113 | node_cmd = "rollup" |
| 114 | args = [ |
| 115 | "-c", |
| 116 | rebase_path("rollup.config.js", root_build_dir), |
| 117 | rebase_path(invoker.input, root_build_dir), |
| 118 | "-o", |
| 119 | rebase_path(invoker.output, root_build_dir), |
| 120 | "-f", |
| 121 | "iife", |
| 122 | "-m", |
| 123 | "--silent", |
| 124 | ] |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | # +----------------------------------------------------------------------------+ |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 129 | # | Bundles all *.js files together resolving CommonJS require() deps. | |
| 130 | # +----------------------------------------------------------------------------+ |
| 131 | |
| 132 | # Bundle together all js sources into a bundle.js file, that will ultimately be |
| 133 | # included by the .html files. |
Hector Dearman | 5f11e52 | 2018-05-31 16:54:28 +0100 | [diff] [blame] | 134 | |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 135 | bundle("frontend_bundle") { |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 136 | deps = [ |
| 137 | ":transpile_all_ts", |
| 138 | ] |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 139 | input = "$target_out_dir/frontend/index.js" |
| 140 | output = "$target_out_dir/frontend_bundle.js" |
Hector Dearman | 5f11e52 | 2018-05-31 16:54:28 +0100 | [diff] [blame] | 141 | } |
| 142 | |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 143 | bundle("controller_bundle") { |
Hector Dearman | 5f11e52 | 2018-05-31 16:54:28 +0100 | [diff] [blame] | 144 | deps = [ |
| 145 | ":transpile_all_ts", |
| 146 | ] |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 147 | input = "$target_out_dir/controller/index.js" |
| 148 | output = "$target_out_dir/controller_bundle.js" |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 149 | } |
| 150 | |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 151 | bundle("engine_bundle") { |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 152 | deps = [ |
| 153 | ":transpile_all_ts", |
| 154 | ] |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 155 | input = "$target_out_dir/engine/index.js" |
| 156 | output = "$target_out_dir/engine_bundle.js" |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 157 | } |
| 158 | |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 159 | # +----------------------------------------------------------------------------+ |
| 160 | # | Protobuf: gen rules to create .js and .d.ts files from protos. | |
| 161 | # +----------------------------------------------------------------------------+ |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 162 | node_bin("protos_to_js") { |
| 163 | inputs = [] |
| 164 | foreach(proto, trace_processor_protos) { |
| 165 | inputs += [ "../protos/perfetto/trace_processor/$proto.proto" ] |
| 166 | } |
Hector Dearman | f5fd1e1 | 2018-06-12 18:23:49 +0100 | [diff] [blame] | 167 | inputs += [ "../protos/perfetto/config/perfetto_config.proto" ] |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 168 | outputs = [ |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 169 | "$ui_gen_dir/protos.js", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 170 | ] |
| 171 | node_cmd = "pbjs" |
| 172 | args = [ |
| 173 | "-t", |
| 174 | "static-module", |
| 175 | "-w", |
| 176 | "commonjs", |
| 177 | "-p", |
| 178 | rebase_path("../protos", root_build_dir), |
| 179 | "-o", |
| 180 | rebase_path(outputs[0], root_build_dir), |
| 181 | ] + rebase_path(inputs, root_build_dir) |
| 182 | } |
| 183 | |
| 184 | # Protobuf.js requires to first generate .js files from the .proto and then |
| 185 | # create .ts definitions for them. |
| 186 | node_bin("protos_to_ts") { |
| 187 | deps = [ |
| 188 | ":protos_to_js", |
| 189 | ] |
| 190 | inputs = [ |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 191 | "$ui_gen_dir/protos.js", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 192 | ] |
| 193 | outputs = [ |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 194 | "$ui_gen_dir/protos.d.ts", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 195 | ] |
| 196 | node_cmd = "pbts" |
| 197 | args = [ |
| 198 | "-p", |
| 199 | rebase_path("../protos", root_build_dir), |
| 200 | "-o", |
| 201 | rebase_path(outputs[0], root_build_dir), |
| 202 | rebase_path(inputs[0], root_build_dir), |
| 203 | ] |
| 204 | } |
| 205 | |
| 206 | # +----------------------------------------------------------------------------+ |
| 207 | # | TypeScript: transpiles all *.ts into .js | |
| 208 | # +----------------------------------------------------------------------------+ |
| 209 | |
| 210 | # Builds all .ts sources in the repo that are reachable from |sources|. |
| 211 | node_bin("transpile_all_ts") { |
| 212 | sources = [ |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 213 | "src/controller/index.ts", |
| 214 | "src/engine/index.ts", |
| 215 | "src/frontend/index.ts", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 216 | ] |
| 217 | deps = [ |
| 218 | ":dist_symlink", |
| 219 | ":protos_to_ts", |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 220 | ":wasm_gen", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 221 | ] |
| 222 | inputs = sources + [ "tsconfig.json" ] |
| 223 | outputs = [ |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 224 | "$target_out_dir/frontend/index.js", |
| 225 | "$target_out_dir/engine/index.js", |
| 226 | "$target_out_dir/controller/index.js", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 227 | ] |
| 228 | |
| 229 | # Find all *.ts files and pass them as input triggers. This does NOT affect |
| 230 | # which files will get built. This defines only the set of files that, when |
| 231 | # changes, will re-trigger this rule in ninja. The files that get transpiled |
| 232 | # are the transitive dependencies of |sources|. |
| 233 | all_ts_files = exec_script("../gn/standalone/glob.py", |
| 234 | [ |
| 235 | "--root=" + rebase_path(".", root_build_dir), |
| 236 | "--filter=*.ts", |
| 237 | "--exclude=node_modules", |
| 238 | "--exclude=dist", |
| 239 | ], |
| 240 | "list lines", |
| 241 | [ "." ]) |
| 242 | inputs += all_ts_files |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 243 | node_cmd = "tsc" |
| 244 | args = [ |
| 245 | "--project", |
| 246 | rebase_path(".", root_build_dir), |
| 247 | "--outDir", |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 248 | rebase_path(target_out_dir, root_build_dir), |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 249 | ] |
| 250 | } |
| 251 | |
| 252 | # +----------------------------------------------------------------------------+ |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 253 | # | Copy rules: create the final output directory. | |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 254 | # +----------------------------------------------------------------------------+ |
Hector Dearman | 1064151 | 2018-07-04 10:38:53 +0100 | [diff] [blame] | 255 | copy("index_dist") { |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 256 | sources = [ |
| 257 | "index.html", |
| 258 | ] |
| 259 | outputs = [ |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 260 | "$ui_dir/index.html", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 261 | ] |
| 262 | } |
| 263 | |
Hector Dearman | daca6cd | 2018-07-11 12:55:34 +0100 | [diff] [blame] | 264 | copy("css_dist") { |
| 265 | sources = [ |
| 266 | "perfetto.css", |
| 267 | ] |
| 268 | outputs = [ |
| 269 | "$ui_dir/perfetto.css", |
| 270 | ] |
| 271 | } |
| 272 | |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 273 | sorcery("frontend_bundle_dist") { |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 274 | deps = [ |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 275 | ":frontend_bundle", |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 276 | ] |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 277 | input = "$target_out_dir/frontend_bundle.js" |
| 278 | output = "$ui_dir/frontend_bundle.js" |
Hector Dearman | 5f11e52 | 2018-05-31 16:54:28 +0100 | [diff] [blame] | 279 | } |
| 280 | |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 281 | sorcery("controller_bundle_dist") { |
Hector Dearman | 5f11e52 | 2018-05-31 16:54:28 +0100 | [diff] [blame] | 282 | deps = [ |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 283 | ":controller_bundle", |
Hector Dearman | 5f11e52 | 2018-05-31 16:54:28 +0100 | [diff] [blame] | 284 | ] |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 285 | input = "$target_out_dir/controller_bundle.js" |
| 286 | output = "$ui_dir/controller_bundle.js" |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 287 | } |
| 288 | |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 289 | sorcery("engine_bundle_dist") { |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 290 | deps = [ |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 291 | ":engine_bundle", |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 292 | ] |
Hector Dearman | 81804d1 | 2018-07-10 11:38:15 +0100 | [diff] [blame] | 293 | input = "$target_out_dir/engine_bundle.js" |
| 294 | output = "$ui_dir/engine_bundle.js" |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 295 | } |
| 296 | |
Hector Dearman | 1064151 | 2018-07-04 10:38:53 +0100 | [diff] [blame] | 297 | copy("wasm_dist") { |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 298 | deps = [ |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 299 | "//src/trace_processor:trace_processor.wasm($wasm_toolchain)", |
| 300 | ] |
| 301 | sources = [ |
| 302 | "$root_build_dir/wasm/trace_processor.wasm", |
| 303 | ] |
| 304 | outputs = [ |
| 305 | "$ui_dir/{{source_file_part}}", |
| 306 | ] |
| 307 | } |
| 308 | |
| 309 | copy("wasm_gen") { |
| 310 | deps = [ |
| 311 | ":dist_symlink", |
| 312 | "//src/trace_processor:trace_processor.d.ts($wasm_toolchain)", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 313 | "//src/trace_processor:trace_processor.js($wasm_toolchain)", |
| 314 | "//src/trace_processor:trace_processor.wasm($wasm_toolchain)", |
| 315 | ] |
| 316 | sources = [ |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 317 | "$root_build_dir/wasm/trace_processor.d.ts", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 318 | "$root_build_dir/wasm/trace_processor.js", |
| 319 | "$root_build_dir/wasm/trace_processor.wasm", |
| 320 | ] |
| 321 | outputs = [ |
Hector Dearman | 21fa916 | 2018-06-22 14:50:29 +0100 | [diff] [blame] | 322 | "$ui_gen_dir/{{source_file_part}}", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 323 | ] |
| 324 | } |
| 325 | |
| 326 | # +----------------------------------------------------------------------------+ |
Deepanjan Roy | acf8c07 | 2018-07-13 11:37:04 -0400 | [diff] [blame^] | 327 | # | Node JS: Creates a symlink in the out directory to node_modules. | |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 328 | # +----------------------------------------------------------------------------+ |
| 329 | |
| 330 | action("check_node_exists") { |
| 331 | script = "../gn/standalone/check_buildtool_exists.py" |
Hector Dearman | 48783b1 | 2018-05-22 08:26:06 +0100 | [diff] [blame] | 332 | args = [ |
| 333 | nodejs_bin, |
| 334 | "--touch", |
| 335 | rebase_path("$target_out_dir/node_exists", ""), |
| 336 | ] |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 337 | inputs = [] |
| 338 | outputs = [ |
Hector Dearman | 48783b1 | 2018-05-22 08:26:06 +0100 | [diff] [blame] | 339 | "$target_out_dir/node_exists", |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 340 | ] |
| 341 | } |
| 342 | |
| 343 | # Creates a symlink from out/xxx/ui/node_modules -> ../../../ui/node_modules. |
Hector Dearman | b06d415 | 2018-05-31 16:55:04 +0100 | [diff] [blame] | 344 | # This allows to run rollup and other node tools from the out/xxx directory. |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 345 | action("node_modules_symlink") { |
| 346 | deps = [ |
| 347 | ":check_node_exists", |
| 348 | ] |
Hector Dearman | 6186c87 | 2018-05-31 13:28:48 +0100 | [diff] [blame] | 349 | |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 350 | script = "../gn/standalone/build_tool_wrapper.py" |
Hector Dearman | 6186c87 | 2018-05-31 13:28:48 +0100 | [diff] [blame] | 351 | stamp_file = "$target_out_dir/.$target_name.stamp" |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 352 | args = [ |
Hector Dearman | 6186c87 | 2018-05-31 13:28:48 +0100 | [diff] [blame] | 353 | "--stamp", |
| 354 | rebase_path(stamp_file, root_build_dir), |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 355 | "/bin/ln", |
| 356 | "-fns", |
Hector Dearman | a817a06 | 2018-06-01 11:01:07 +0100 | [diff] [blame] | 357 | rebase_path("node_modules", target_out_dir), |
Hector Dearman | 6186c87 | 2018-05-31 13:28:48 +0100 | [diff] [blame] | 358 | rebase_path("$target_out_dir/node_modules", root_build_dir), |
| 359 | ] |
| 360 | outputs = [ |
| 361 | stamp_file, |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 362 | ] |
| 363 | } |
| 364 | |
Hector Dearman | 6186c87 | 2018-05-31 13:28:48 +0100 | [diff] [blame] | 365 | group("node_modules") { |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 366 | deps = [ |
| 367 | ":node_modules_symlink", |
| 368 | ] |
| 369 | } |
| 370 | |
| 371 | # Creates a symlink from //ui/dist -> ../../out/xxx/ui. Used only for |
| 372 | # autocompletion in IDEs. The problem this is solving is that in tsconfig.json |
| 373 | # we can't possibly know the path to ../../out/xxx for outDir. Instead, we set |
| 374 | # outDir to "./dist" and create a symlink on the first build. |
| 375 | action("dist_symlink") { |
| 376 | script = "../gn/standalone/build_tool_wrapper.py" |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 377 | stamp_file = "$target_out_dir/.$target_name.stamp" |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 378 | args = [ |
| 379 | "--stamp", |
| 380 | rebase_path(stamp_file, root_build_dir), |
| 381 | "/bin/ln", |
| 382 | "-fns", |
Hector Dearman | 262cbe2 | 2018-05-31 13:28:21 +0100 | [diff] [blame] | 383 | rebase_path(target_out_dir, "."), |
Primiano Tucci | 3faad74 | 2018-05-16 19:30:48 +0100 | [diff] [blame] | 384 | rebase_path("dist", root_build_dir), |
| 385 | ] |
| 386 | inputs = [ |
| 387 | "$root_build_dir", |
| 388 | ] |
| 389 | outputs = [ |
| 390 | stamp_file, |
| 391 | ] |
| 392 | } |
Hector Dearman | bf38492 | 2018-06-25 10:42:01 +0100 | [diff] [blame] | 393 | |
| 394 | group("test_scripts") { |
| 395 | deps = [ |
| 396 | ":copy_tests_script", |
| 397 | ":copy_unittests_script", |
| 398 | ] |
| 399 | } |
| 400 | |
| 401 | copy("copy_unittests_script") { |
| 402 | sources = [ |
| 403 | "config/ui_unittests_template", |
| 404 | ] |
| 405 | outputs = [ |
| 406 | "$root_build_dir/ui_unittests", |
| 407 | ] |
| 408 | } |
| 409 | |
| 410 | copy("copy_tests_script") { |
| 411 | sources = [ |
| 412 | "config/ui_tests_template", |
| 413 | ] |
| 414 | outputs = [ |
| 415 | "$root_build_dir/ui_tests", |
| 416 | ] |
| 417 | } |