Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Unified Diff: third_party/closure_compiler/compile2.py

Issue 2930773003: Closure compilation: Modify compile_js2.py to not swallow errors. (Closed)
Patch Set: More changes. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/closure_compiler/compiler_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/compile2.py
diff --git a/third_party/closure_compiler/compile2.py b/third_party/closure_compiler/compile2.py
index 224856d7227192fd022b0f655d4574c414254349..8b4f26405983d35d5d516e2781979c565a1ec90a 100755
--- a/third_party/closure_compiler/compile2.py
+++ b/third_party/closure_compiler/compile2.py
@@ -176,8 +176,12 @@ class Checker(object):
in GYP dependency order).
Returns:
- (found_errors, stderr) A boolean indicating whether errors were found and
- the raw Closure compiler stderr (as a string).
+ (return_code, found_errors, stderr) The return code from the jar command,
+ a boolean indicating whether type checking related errors were found
+ and the raw Closure compiler stderr (as a string). Note that it is
+ possible for |found_errors| to be false, and |return_code| to be
+ non-zero, for example when wrong flags are passed to the compiler
+ (which yields an InvalidOptionsException)
"""
is_extern = lambda f: 'externs' in f
externs_and_deps = [self._POLYMER_EXTERNS]
@@ -243,7 +247,7 @@ class Checker(object):
self._log_debug("Args: %s" % " ".join(args))
- _, stderr = self.run_jar(self._compiler_jar, args)
+ return_code, stderr = self.run_jar(self._compiler_jar, args)
errors = stderr.strip().split("\n\n")
maybe_summary = errors.pop()
@@ -280,7 +284,7 @@ class Checker(object):
self._log_debug("Output: %s" % output)
self._nuke_temp_files()
- return bool(errors), stderr
+ return return_code, bool(errors), stderr
dpapad 2017/06/08 22:26:05 An alternative to adding a new return variable, is
if __name__ == "__main__":
@@ -303,12 +307,13 @@ if __name__ == "__main__":
checker = Checker(verbose=opts.verbose)
- found_errors, stderr = checker.check(opts.sources, out_file=opts.out_file,
- closure_args=opts.closure_args,
- custom_sources=opts.custom_sources,
- custom_includes=opts.custom_includes)
+ return_code, found_errors, stderr = checker.check(
+ opts.sources, out_file=opts.out_file,
+ closure_args=opts.closure_args,
+ custom_sources=opts.custom_sources,
+ custom_includes=opts.custom_includes)
- if found_errors:
+ if found_errors or return_code > 0 :
if opts.custom_sources:
print stderr
sys.exit(1)
« no previous file with comments | « no previous file | third_party/closure_compiler/compiler_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698