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 . \ |
11 third_party/closure_compiler/compiled_resources.gyp | 11 third_party/closure_compiler/compiled_resources.gyp |
12 ninja -C out/Default | 12 ninja -C out/Default |
13 ``` | 13 ``` |
14 | 14 |
15 ## Background | 15 ## Background |
16 | 16 |
17 In C++ and Java, compiling the code gives you _some_ level of protection against | 17 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 | 18 misusing variables based on their type information. JavaScript is loosely typed |
19 and therefore doesn't offer this safety. This makes writing JavaScript more | 19 and therefore doesn't offer this safety. This makes writing JavaScript more |
20 error prone as it's _one more thing_ to mess up. | 20 error prone as it's _one more thing_ to mess up. |
21 | 21 |
22 Because having this safety is handy, Chrome now has a way to optionally | 22 Because having this safety is handy, Chrome now has a way to optionally |
23 typecheck your JavaScript and produce compiled output with | 23 typecheck your JavaScript and produce compiled output with |
24 [Closure Compiler](https://developers.google.com/closure/compiler/). | 24 [Closure Compiler](https://developers.google.com/closure/compiler/). |
| 25 The type information is |
| 26 [annotated in comment tags](https://developers.google.com/closure/compiler/docs/
js-for-compiler) |
| 27 that are briefly described below. |
25 | 28 |
26 See also: | 29 See also: |
27 [the design doc](https://docs.google.com/a/chromium.org/document/d/1Ee9ggmp6U-lM
-w9WmxN5cSLkK9B5YAq14939Woo-JY0/edit). | 30 [the design doc](https://docs.google.com/a/chromium.org/document/d/1Ee9ggmp6U-lM
-w9WmxN5cSLkK9B5YAq14939Woo-JY0/edit). |
28 | 31 |
29 ## Assumptions | 32 ## Assumptions |
30 | 33 |
31 A working Chrome checkout. See here: | 34 A working Chrome checkout. See here: |
32 http://www.chromium.org/developers/how-tos/get-the-code | 35 http://www.chromium.org/developers/how-tos/get-the-code |
33 | 36 |
34 ## Typechecking Your Javascript | 37 ## Typechecking Your Javascript |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 'jscomp_error=duplicate', | 272 'jscomp_error=duplicate', |
270 'jscomp_error=misplacedTypeAnnotation', | 273 'jscomp_error=misplacedTypeAnnotation', |
271 ], | 274 ], |
272 'disabled_closure_args': [], # remove the disabled closure args for more
strict compilation | 275 'disabled_closure_args': [], # remove the disabled closure args for more
strict compilation |
273 }, | 276 }, |
274 'includes': ['../third_party/closure_compiler/compile_js.gypi'], | 277 'includes': ['../third_party/closure_compiler/compile_js.gypi'], |
275 }, | 278 }, |
276 ], | 279 ], |
277 } | 280 } |
278 ``` | 281 ``` |
OLD | NEW |