OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 17 matching lines...) Expand all Loading... |
28 _JAR_COMMAND = [ | 28 _JAR_COMMAND = [ |
29 "java", | 29 "java", |
30 "-jar", | 30 "-jar", |
31 "-Xms1024m", | 31 "-Xms1024m", |
32 "-client", | 32 "-client", |
33 "-XX:+TieredCompilation" | 33 "-XX:+TieredCompilation" |
34 ] | 34 ] |
35 | 35 |
36 _MAP_FILE_FORMAT = "%s.map" | 36 _MAP_FILE_FORMAT = "%s.map" |
37 | 37 |
38 _POLYMER_EXTERNS = os.path.join(_CURRENT_DIR, "..", "polymer", | 38 _POLYMER_EXTERNS = os.path.join(_CURRENT_DIR, "externs", "polymer-1.0.js") |
39 "v1_0", "components-chromium", | |
40 "polymer-externs", "polymer.externs.js") | |
41 | 39 |
42 def __init__(self, verbose=False): | 40 def __init__(self, verbose=False): |
43 """ | 41 """ |
44 Args: | 42 Args: |
45 verbose: Whether this class should output diagnostic messages. | 43 verbose: Whether this class should output diagnostic messages. |
46 strict: Whether the Closure Compiler should be invoked more strictly. | 44 strict: Whether the Closure Compiler should be invoked more strictly. |
47 """ | 45 """ |
48 self._runner_jar = os.path.join(_CURRENT_DIR, "runner", "runner.jar") | 46 self._runner_jar = os.path.join(_CURRENT_DIR, "runner", "runner.jar") |
49 self._target = None | 47 self._target = None |
50 self._temp_files = [] | 48 self._temp_files = [] |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 checker = Checker(verbose=opts.verbose) | 314 checker = Checker(verbose=opts.verbose) |
317 | 315 |
318 found_errors, stderr = checker.check(opts.sources, out_file=opts.out_file, | 316 found_errors, stderr = checker.check(opts.sources, out_file=opts.out_file, |
319 closure_args=opts.closure_args, | 317 closure_args=opts.closure_args, |
320 custom_sources=opts.custom_sources) | 318 custom_sources=opts.custom_sources) |
321 | 319 |
322 if found_errors: | 320 if found_errors: |
323 if opts.custom_sources: | 321 if opts.custom_sources: |
324 print stderr | 322 print stderr |
325 sys.exit(1) | 323 sys.exit(1) |
OLD | NEW |