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

Unified Diff: third_party/closure_compiler/checker.py

Issue 421253006: Add ChromeCodingConvention.java to Closure Compiler to preserve getInstance() type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@A_typechecking_about
Patch Set: Fix comments Created 6 years, 5 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
Index: third_party/closure_compiler/checker.py
diff --git a/third_party/closure_compiler/checker.py b/third_party/closure_compiler/checker.py
index 5ae34951f399d68082667aed5c3d1f10d69ebbab..ad465d43cad217b2da095f32bf283ad9c1eb7159 100644
--- a/third_party/closure_compiler/checker.py
+++ b/third_party/closure_compiler/checker.py
@@ -19,7 +19,7 @@ class LineNumber(object):
class FileCache(object):
_cache = defaultdict(str)
-
+
def _read(self, file):
file = os.path.abspath(file)
self._cache[file] = self._cache[file] or open(file, "r").read()
@@ -105,12 +105,13 @@ class Checker(object):
"-XX:+TieredCompilation"
]
- def __init__(self, verbose=False):
+ def __init__(self, verbose=False, return_output=False):
current_dir = os.path.join(os.path.dirname(__file__))
self._compiler_jar = os.path.join(current_dir, "lib", "compiler.jar")
self._runner_jar = os.path.join(current_dir, "runner", "runner.jar")
self._temp_files = []
self._verbose = verbose
+ self._return_output = return_output
def _clean_up(self):
if not self._temp_files:
@@ -212,11 +213,16 @@ class Checker(object):
self._debug("Summary: " + errors.pop())
output = self._format_errors(map(self._fix_up_error, errors))
- if runner_cmd.returncode:
- self._fatal("Error in: " + file + ("\n" + output if output else ""))
- elif output:
- self._debug("Output: " + output)
-
- self._clean_up()
+ if self._return_output:
+ self._clean_up()
+
+ return output
Dan Beam 2014/07/29 19:17:16 why not just return both the output and returncode
Vitaly Pavlenko 2014/07/29 20:26:18 Done.
+ else:
+ if runner_cmd.returncode:
+ self._fatal("Error in: " + file + ("\n" + output if output else ""))
+ elif output:
+ self._debug("Output: " + output)
+
+ self._clean_up()
- return runner_cmd.returncode == 0
+ return runner_cmd.returncode == 0

Powered by Google App Engine
This is Rietveld 408576698