OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Runs Closure compiler on JavaScript files to check for errors and produce | 6 """Runs Closure compiler on JavaScript files to check for errors and produce |
7 minified output.""" | 7 minified output.""" |
8 | 8 |
9 import argparse | 9 import argparse |
10 import os | 10 import os |
(...skipping 29 matching lines...) Expand all Loading... | |
40 "missingReturn", | 40 "missingReturn", |
41 "nonStandardJsDocs", | 41 "nonStandardJsDocs", |
42 "suspiciousCode", | 42 "suspiciousCode", |
43 "undefinedNames", | 43 "undefinedNames", |
44 "undefinedVars", | 44 "undefinedVars", |
45 "unknownDefines", | 45 "unknownDefines", |
46 "uselessCode", | 46 "uselessCode", |
47 "visibility", | 47 "visibility", |
48 ] | 48 ] |
49 | 49 |
50 # Extra @jsDocAnnotations used when compiling polymer code. | 50 # Extra @jsDocAnnotations used when compiling Chrome JS. |
51 _POLYMER_EXTRA_ANNOTATIONS = [ | 51 _EXTRA_ANNOTATIONS = [ |
Dan Beam
2015/05/12 23:09:20
nit: _EXTRA_JSDOC_ANNOTATIONS, remove comment
Jeremy Klein
2015/05/12 23:39:24
Reverting this file's changes.
| |
52 "attribute", | 52 "attribute", |
53 "status", | 53 "status", |
54 "element", | 54 "element", |
55 "homepage", | 55 "homepage", |
56 "submodule", | 56 "submodule", |
57 "group", | 57 "group", |
58 "suppressReceiverCheck", | |
Tyler Breisacher (Chromium)
2015/05/12 21:39:51
This seems to come from the devtools code. I reall
Jeremy Klein
2015/05/12 23:39:24
Done.
| |
58 ] | 59 ] |
59 | 60 |
60 _COMMON_CLOSURE_ARGS = [ | 61 _COMMON_CLOSURE_ARGS = [ |
61 "--accept_const_keyword", | 62 "--accept_const_keyword", |
62 "--language_in=ECMASCRIPT5_STRICT", | 63 "--language_in=ECMASCRIPT5_STRICT", |
63 "--summary_detail_level=3", | 64 "--summary_detail_level=3", |
64 "--compilation_level=SIMPLE_OPTIMIZATIONS", | 65 "--compilation_level=SIMPLE_OPTIMIZATIONS", |
65 "--source_map_format=V3", | 66 "--source_map_format=V3", |
66 "--polymer_pass", | 67 "--polymer_pass", |
67 ] + [ | 68 ] + [ |
68 "--jscomp_error=%s" % err for err in _COMMON_JSCOMP_ERRORS | 69 "--jscomp_error=%s" % err for err in _COMMON_JSCOMP_ERRORS |
69 ] + [ | 70 ] + [ |
70 "--extra_annotation_name=%s" % a for a in _POLYMER_EXTRA_ANNOTATIONS | 71 "--extra_annotation_name=%s" % a for a in _EXTRA_ANNOTATIONS |
71 ] | 72 ] |
72 | 73 |
73 # These are the extra flags used when compiling in strict mode. | 74 # These are the extra flags used when compiling in strict mode. |
74 # Flags that are normally disabled are turned on for strict mode. | 75 # Flags that are normally disabled are turned on for strict mode. |
75 _STRICT_CLOSURE_ARGS = [ | 76 _STRICT_CLOSURE_ARGS = [ |
76 "--jscomp_error=reportUnknownTypes", | 77 "--jscomp_error=reportUnknownTypes", |
77 "--jscomp_error=duplicate", | 78 "--jscomp_error=duplicate", |
78 "--jscomp_error=misplacedTypeAnnotation", | 79 "--jscomp_error=misplacedTypeAnnotation", |
79 ] | 80 ] |
80 | 81 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 out_file=opts.out_file, | 441 out_file=opts.out_file, |
441 output_wrapper=opts.output_wrapper, | 442 output_wrapper=opts.output_wrapper, |
442 externs=externs) | 443 externs=externs) |
443 if found_errors: | 444 if found_errors: |
444 print stderr | 445 print stderr |
445 sys.exit(1) | 446 sys.exit(1) |
446 | 447 |
447 if opts.success_stamp: | 448 if opts.success_stamp: |
448 with open(opts.success_stamp, "w"): | 449 with open(opts.success_stamp, "w"): |
449 os.utime(opts.success_stamp, None) | 450 os.utime(opts.success_stamp, None) |
OLD | NEW |