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

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: final fixes 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
« no previous file with comments | « no previous file | third_party/closure_compiler/coding_conventions_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a6ee574085ec6b92c69b16864fd5ea81ac0ea653 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, exit_on_fatal=True):
Dan Beam 2014/07/29 23:27:44 remove this parameter
Vitaly Pavlenko 2014/07/29 23:42:26 Done.
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._exit_on_fatal = exit_on_fatal
def _clean_up(self):
if not self._temp_files:
@@ -128,7 +129,10 @@ class Checker(object):
def _fatal(self, msg):
print >> sys.stderr, "(FATAL) " + msg
self._clean_up()
- sys.exit(1)
+ if self._exit_on_fatal:
+ sys.exit(1)
+ else:
+ return 1
Dan Beam 2014/07/29 23:27:44 i meant return 1 as the exit code of calling check
Vitaly Pavlenko 2014/07/29 23:42:26 Done.
def _run_command(self, cmd):
cmd_str = " ".join(cmd)
@@ -212,11 +216,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 ""))
+ message = "Error in: " + file + ("\n" + output if output else "")
+ if self._exit_on_fatal:
+ self._fatal(message)
+ else:
+ self._debug(message)
elif output:
self._debug("Output: " + output)
-
+
self._clean_up()
- return runner_cmd.returncode == 0
+ return runner_cmd.returncode == 0, output
« no previous file with comments | « no previous file | third_party/closure_compiler/coding_conventions_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698