OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/features.gni") | 5 import("//build/config/features.gni") |
6 import("//testing/test.gni") | 6 import("//testing/test.gni") |
7 import("//chrome/test/base/js2gtest.gni") | 7 import("//chrome/test/base/js2gtest.gni") |
| 8 import("run_jsbundler.gni") |
8 | 9 |
9 assert(is_chromeos) | 10 assert(is_chromeos) |
10 | 11 |
11 declare_args() { | 12 declare_args() { |
12 # Whether to compress the main Chromevox javascript files or load the | 13 # Whether to compress the main Chromevox javascript files or load the |
13 # modules individually from source files. | 14 # modules individually from source files. |
14 chromevox_compress_js = !is_debug | 15 chromevox_compress_js = !is_debug |
15 } | 16 } |
16 | 17 |
17 closure_library_dir = | 18 closure_library_dir = |
18 "//chrome/third_party/chromevox/third_party/closure-library/closure/goog" | 19 "//chrome/third_party/chromevox/third_party/closure-library/closure/goog" |
19 | 20 |
20 jsbundler_modules = rebase_path([ | |
21 "depstree.py", | |
22 "source.py", | |
23 "treescan.py", | |
24 ], | |
25 ".", | |
26 "$closure_library_dir/../bin/build") | |
27 jsbundler_modules += | |
28 [ "//third_party/WebKit/Source/devtools/scripts/rjsmin.py" ] | |
29 | |
30 # List of all modules that are included in one or more of the production | 21 # List of all modules that are included in one or more of the production |
31 # chromevox scripts. | 22 # chromevox scripts. |
32 chromevox_modules = [ | 23 chromevox_modules = [ |
33 "braille/braille_display_manager.js", | 24 "braille/braille_display_manager.js", |
34 "braille/braille_input_handler.js", | 25 "braille/braille_input_handler.js", |
35 "braille/braille_key_types.js", | 26 "braille/braille_key_types.js", |
36 "braille/braille_table.js", | 27 "braille/braille_table.js", |
37 "braille/braille_translator_manager.js", | 28 "braille/braille_translator_manager.js", |
38 "braille/expanding_braille_translator.js", | 29 "braille/expanding_braille_translator.js", |
39 "braille/liblouis.js", | 30 "braille/liblouis.js", |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ":chromevox_kbexplorer_script", | 242 ":chromevox_kbexplorer_script", |
252 ":chromevox_min_content_script", | 243 ":chromevox_min_content_script", |
253 ":chromevox_options_script", | 244 ":chromevox_options_script", |
254 ":chromevox_panel_script", | 245 ":chromevox_panel_script", |
255 ] | 246 ] |
256 } else { | 247 } else { |
257 deps += [ ":chromevox_deps_js" ] | 248 deps += [ ":chromevox_deps_js" ] |
258 } | 249 } |
259 } | 250 } |
260 | 251 |
261 template("run_jsbundler") { | |
262 assert(defined(invoker.mode)) | |
263 assert(defined(invoker.sources)) | |
264 if (defined(invoker.modules)) { | |
265 modules = invoker.modules | |
266 } else { | |
267 modules = [] | |
268 } | |
269 if (defined(invoker.rewrite_rules)) { | |
270 rewrite_rules = invoker.rewrite_rules | |
271 } else { | |
272 rewrite_rules = [] | |
273 } | |
274 action(target_name) { | |
275 script = "tools/jsbundler.py" | |
276 inputs = jsbundler_modules | |
277 sources = invoker.sources | |
278 if (defined(invoker.output_file)) { | |
279 if (defined(invoker.modules)) { | |
280 depfile = "$target_out_dir/" + | |
281 get_path_info(invoker.output_file, "name") + ".d" | |
282 } | |
283 outputs = [ | |
284 invoker.output_file, | |
285 ] | |
286 } else { | |
287 assert(!defined(invoker.modules)) | |
288 stampfile = "$target_out_dir/${target_name}_copy.stamp" | |
289 outputs = [ | |
290 stampfile, | |
291 ] | |
292 } | |
293 args = [ | |
294 "-m", | |
295 invoker.mode, | |
296 ] | |
297 if (defined(depfile)) { | |
298 args += [ | |
299 "--depfile", | |
300 rebase_path(depfile, root_build_dir), | |
301 ] | |
302 } | |
303 if (defined(stampfile)) { | |
304 args += [ | |
305 "--stampfile", | |
306 rebase_path(stampfile, root_build_dir), | |
307 ] | |
308 } | |
309 if (defined(invoker.output_file)) { | |
310 args += [ | |
311 "-o", | |
312 rebase_path(invoker.output_file, root_build_dir), | |
313 ] | |
314 } | |
315 if (defined(invoker.dest_dir)) { | |
316 args += [ | |
317 "-d", | |
318 rebase_path(invoker.dest_dir, root_build_dir), | |
319 ] | |
320 } | |
321 foreach(module, modules) { | |
322 args += [ | |
323 "-M", | |
324 rebase_path(module, root_build_dir), | |
325 ] | |
326 } | |
327 foreach(rule, rewrite_rules) { | |
328 args += [ | |
329 "-w", | |
330 rule, | |
331 ] | |
332 } | |
333 args += rebase_path(sources, root_build_dir) | |
334 } | |
335 } | |
336 | |
337 chromevox_background_script_loader_file = "cvox2/background/loader.js" | 252 chromevox_background_script_loader_file = "cvox2/background/loader.js" |
338 chromevox_content_script_loader_file = "chromevox/injected/loader.js" | 253 chromevox_content_script_loader_file = "chromevox/injected/loader.js" |
339 chromevox_kbexplorer_loader_file = "chromevox/background/kbexplorer_loader.js" | 254 chromevox_kbexplorer_loader_file = "chromevox/background/kbexplorer_loader.js" |
340 chromevox_min_content_script_loader_file = "cvox2/injected/loader.js" | 255 chromevox_min_content_script_loader_file = "cvox2/injected/loader.js" |
341 chromevox_options_script_loader_file = "chromevox/background/options_loader.js" | 256 chromevox_options_script_loader_file = "chromevox/background/options_loader.js" |
342 chromevox_panel_script_loader_file = "cvox2/background/panel_loader.js" | 257 chromevox_panel_script_loader_file = "cvox2/background/panel_loader.js" |
343 | 258 |
344 # Instead of setting up one copy target for each subdirectory, use a script | 259 # Instead of setting up one copy target for each subdirectory, use a script |
345 # to copy all files. | 260 # to copy all files. |
346 run_jsbundler("chromevox_copied_files") { | 261 run_jsbundler("chromevox_copied_files") { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 361 } |
447 if (!chromevox_compress_js) { | 362 if (!chromevox_compress_js) { |
448 sources += closure_library_modules | 363 sources += closure_library_modules |
449 } | 364 } |
450 rewrite_rules = [ | 365 rewrite_rules = [ |
451 rebase_path(".", root_build_dir) + ":", | 366 rebase_path(".", root_build_dir) + ":", |
452 rebase_path(closure_library_dir, root_build_dir) + ":closure", | 367 rebase_path(closure_library_dir, root_build_dir) + ":closure", |
453 ] | 368 ] |
454 } | 369 } |
455 | 370 |
| 371 # TODO: refactor this into another file like generate_manifest.gni |
| 372 # to share with other extensions. |
456 template("manifest") { | 373 template("manifest") { |
457 version_file = "//chrome/VERSION" | 374 version_file = "//chrome/VERSION" |
458 version_script = "//build/util/version.py" | 375 version_script = "//build/util/version.py" |
459 template_file = "manifest.json.jinja2" | 376 template_file = "manifest.json.jinja2" |
460 output_file = invoker.output_file | 377 output_file = invoker.output_file |
461 key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDltVl1k15pjRzuZfMc3B69inxwm2bZeZ2
O8/zFO+NluHnBm3GJ3fzdOoFGJd+M16I8p7zxxQyHeDMfWYASyCeB8XnUEDKjqNLQfCnncsANzHsYoEb
Yj2nEUML2P13b9q+AAvpCBpAJ4cZp81e9n1y/vbSXHE4385cgkKueItzikQIDAQAB" | 378 key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDltVl1k15pjRzuZfMc3B69inxwm2bZeZ2
O8/zFO+NluHnBm3GJ3fzdOoFGJd+M16I8p7zxxQyHeDMfWYASyCeB8XnUEDKjqNLQfCnncsANzHsYoEb
Yj2nEUML2P13b9q+AAvpCBpAJ4cZp81e9n1y/vbSXHE4385cgkKueItzikQIDAQAB" |
462 action(target_name) { | 379 action(target_name) { |
463 script = "tools/generate_manifest.py" | 380 script = "tools/generate_manifest.py" |
464 inputs = [ | 381 inputs = [ |
465 version_file, | 382 version_file, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 ] | 681 ] |
765 gen_include_files = [ | 682 gen_include_files = [ |
766 "testing/assert_additions.js", | 683 "testing/assert_additions.js", |
767 "testing/callback_helper.js", | 684 "testing/callback_helper.js", |
768 "testing/chromevox_e2e_test_base.js", | 685 "testing/chromevox_e2e_test_base.js", |
769 "testing/chromevox_next_e2e_test_base.js", | 686 "testing/chromevox_next_e2e_test_base.js", |
770 "testing/mock_feedback.js", | 687 "testing/mock_feedback.js", |
771 ] | 688 ] |
772 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] | 689 defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
773 } | 690 } |
OLD | NEW |