Index: third_party/closure_compiler/checker.py |
diff --git a/third_party/closure_compiler/checker.py b/third_party/closure_compiler/checker.py |
index 2eb9e68a21f606fc41e3e6ba4859649483138d13..2795825f846840553632caf925b15eb4eec7454f 100755 |
--- a/third_party/closure_compiler/checker.py |
+++ b/third_party/closure_compiler/checker.py |
@@ -44,6 +44,8 @@ class Checker(object): |
"--jscomp_error=visibility", |
"--language_in=ECMASCRIPT5_STRICT", |
"--summary_detail_level=3", |
+ "--compilation_level=WHITESPACE_ONLY", |
+ "--source_map_format=V3", |
] |
# These are the extra flags used when compiling in 'strict' mode. |
@@ -177,11 +179,14 @@ class Checker(object): |
tmp_file.write(contents) |
return tmp_file.name |
- def run_js_check(self, sources, externs=None): |
+ def run_js_check(self, sources, out_file, externs=None): |
if not self._check_java_path(): |
return 1, "" |
args = ["--js=%s" % s for s in sources] |
+ args += ["--js_output_file=%s" % out_file] |
+ args += ["--create_source_map=%s.map" % out_file] |
+ |
if externs: |
args += ["--externs=%s" % e for e in externs] |
args_file_content = " %s" % " ".join(self._common_args() + args) |
@@ -201,7 +206,7 @@ class Checker(object): |
return errors, stderr |
- def check(self, source_file, depends=None, externs=None): |
+ def check(self, source_file, out_file, depends=None, externs=None): |
"""Closure compile a file and check for errors. |
Args: |
@@ -240,7 +245,8 @@ class Checker(object): |
self._expanded_file = self._create_temp_file(self._processor.contents) |
self._debug("Expanded file: %s" % self._expanded_file) |
- errors, stderr = self.run_js_check([self._expanded_file], externs) |
+ errors, stderr = self.run_js_check([self._expanded_file], out_file, |
+ externs) |
# Filter out false-positive promise chain errors. |
# See https://github.com/google/closure-compiler/issues/715 for details. |
@@ -304,16 +310,11 @@ if __name__ == "__main__": |
source, |
depends, |
externs) |
- has_errors, _ = checker.check(source, depends=depends, externs=externs) |
+ has_errors, _ = checker.check(source, opts.out_file, depends=depends, |
+ externs=externs) |
if has_errors: |
sys.exit(1) |
- if opts.out_file: |
- out_dir = os.path.dirname(opts.out_file) |
- if not os.path.exists(out_dir): |
- os.makedirs(out_dir) |
Dan Beam
2015/03/06 19:58:55
still need to do this somewhere
$ echo 'alert( 1
Theresa
2015/03/06 20:30:30
Done.
|
- # TODO(dbeam): write compiled file to |opts.out_file|. |
- open(opts.out_file, "w").write("") |
else: |
has_errors, errors = checker.check_multiple(opts.sources) |
if has_errors: |