OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 '''Uses the closure compiler to check syntax and semantics of a js module | 7 '''Uses the closure compiler to check syntax and semantics of a js module |
8 with dependencies.''' | 8 with dependencies.''' |
9 | 9 |
10 import os | 10 import os |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if match is None or int(match.group(1)) < 7: | 57 if match is None or int(match.group(1)) < 7: |
58 _Error('Java 7 or later is required: \n%s' % output) | 58 _Error('Java 7 or later is required: \n%s' % output) |
59 | 59 |
60 _CheckJava() | 60 _CheckJava() |
61 | 61 |
62 | 62 |
63 def RunCompiler(js_files, externs=[]): | 63 def RunCompiler(js_files, externs=[]): |
64 args = [_java_executable, '-jar', _CLOSURE_COMPILER_JAR] | 64 args = [_java_executable, '-jar', _CLOSURE_COMPILER_JAR] |
65 args.extend(['--compilation_level', 'SIMPLE_OPTIMIZATIONS']) | 65 args.extend(['--compilation_level', 'SIMPLE_OPTIMIZATIONS']) |
66 args.extend(['--jscomp_error=%s' % error for error in _JSCOMP_ERRORS]) | 66 args.extend(['--jscomp_error=%s' % error for error in _JSCOMP_ERRORS]) |
67 args.extend(['--language_in', 'ECMASCRIPT5']) | 67 args.extend(['--language_in', 'ECMASCRIPT6']) |
68 args.extend(['--externs=%s' % extern for extern in externs]) | 68 args.extend(['--externs=%s' % extern for extern in externs]) |
69 args.extend(['--js=%s' % js for js in js_files]) | 69 args.extend(['--js=%s' % js for js in js_files]) |
70 args.extend(['--js_output_file', '/dev/null']) | 70 args.extend(['--js_output_file', '/dev/null']) |
71 output = _ExecuteCommand(args, ignore_exit_status=True) | 71 output = _ExecuteCommand(args, ignore_exit_status=True) |
72 success = len(output) == 0 | 72 success = len(output) == 0 |
73 return success, output | 73 return success, output |
OLD | NEW |