OLD | NEW |
1 # Closure Compilation | 1 # Closure Compilation |
2 | 2 |
3 ## I just need to fix the compile! | 3 ## I just need to fix the compile! |
4 | 4 |
5 To locally run closure compiler like the bots, do this: | 5 To locally run closure compiler like the bots, do this: |
6 | 6 |
7 ```shell | 7 ```shell |
8 cd $CHROMIUM_SRC | 8 cd $CHROMIUM_SRC |
9 # sudo apt-get install openjdk-7-jre # may be required | 9 # sudo apt-get install openjdk-7-jre # may be required |
10 GYP_GENERATORS=ninja tools/gyp/gyp --depth . \ | 10 GYP_GENERATORS=ninja tools/gyp/gyp --depth . third_party/closure_compiler/compil
ed_resources.gyp |
11 third_party/closure_compiler/compiled_resources.gyp | |
12 ninja -C out/Default | 11 ninja -C out/Default |
13 ``` | 12 ``` |
14 | 13 |
| 14 To run the v2 gyp format, change the last 2 lines to: |
| 15 |
| 16 ```shell |
| 17 # notice the 2 in compiled_resources2.gyp |
| 18 GYP_GENERATORS=ninja tools/gyp/gyp --depth . third_party/closure_compiler/compil
ed_resources2.gyp |
| 19 ninja -C out/Default |
| 20 ``` |
| 21 |
15 ## Background | 22 ## Background |
16 | 23 |
17 In C++ and Java, compiling the code gives you _some_ level of protection against | 24 In C++ and Java, compiling the code gives you _some_ level of protection against |
18 misusing variables based on their type information. JavaScript is loosely typed | 25 misusing variables based on their type information. JavaScript is loosely typed |
19 and therefore doesn't offer this safety. This makes writing JavaScript more | 26 and therefore doesn't offer this safety. This makes writing JavaScript more |
20 error prone as it's _one more thing_ to mess up. | 27 error prone as it's _one more thing_ to mess up. |
21 | 28 |
22 Because having this safety is handy, Chrome now has a way to optionally | 29 Because having this safety is handy, Chrome now has a way to optionally |
23 typecheck your JavaScript and produce compiled output with | 30 typecheck your JavaScript and produce compiled output with |
24 [Closure Compiler](https://developers.google.com/closure/compiler/). | 31 [Closure Compiler](https://developers.google.com/closure/compiler/). |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 'jscomp_error=duplicate', | 279 'jscomp_error=duplicate', |
273 'jscomp_error=misplacedTypeAnnotation', | 280 'jscomp_error=misplacedTypeAnnotation', |
274 ], | 281 ], |
275 'disabled_closure_args': [], # remove the disabled closure args for more
strict compilation | 282 'disabled_closure_args': [], # remove the disabled closure args for more
strict compilation |
276 }, | 283 }, |
277 'includes': ['../third_party/closure_compiler/compile_js.gypi'], | 284 'includes': ['../third_party/closure_compiler/compile_js.gypi'], |
278 }, | 285 }, |
279 ], | 286 ], |
280 } | 287 } |
281 ``` | 288 ``` |
OLD | NEW |