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

Side by Side Diff: third_party/closure_compiler/compile.py

Issue 2273813002: Fix Closure Compiler's compile.py error checking to match compile2.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed error checking to use return code instead of regex checking Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Runs Closure compiler on JavaScript files to check for errors and produce 6 """Runs Closure compiler on JavaScript files to check for errors and produce
7 minified output.""" 7 minified output."""
8 8
9 import argparse 9 import argparse
10 import os 10 import os
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 args += ["--%s" % arg for arg in closure_args] 216 args += ["--%s" % arg for arg in closure_args]
217 217
218 args_file_content = " %s" % " ".join(args) 218 args_file_content = " %s" % " ".join(args)
219 self._log_debug("Args: %s" % args_file_content.strip()) 219 self._log_debug("Args: %s" % args_file_content.strip())
220 220
221 args_file = self._create_temp_file(args_file_content) 221 args_file = self._create_temp_file(args_file_content)
222 self._log_debug("Args file: %s" % args_file) 222 self._log_debug("Args file: %s" % args_file)
223 223
224 processed_runner_args = ["--%s" % arg for arg in runner_args or []] 224 processed_runner_args = ["--%s" % arg for arg in runner_args or []]
225 processed_runner_args += ["--compiler-args-file=%s" % args_file] 225 processed_runner_args += ["--compiler-args-file=%s" % args_file]
226 _, stderr = self._run_jar(self._runner_jar, processed_runner_args) 226 return_code, stderr = self._run_jar(self._runner_jar, processed_runner_args)
227 227
228 errors = stderr.strip().split("\n\n") 228 errors = stderr.strip().split("\n\n")
229 maybe_summary = errors.pop() 229 maybe_summary = errors.pop()
230 230
231 if re.search(".*error.*warning.*typed", maybe_summary): 231 if return_code == 0:
232 self._log_debug("Summary: %s" % maybe_summary) 232 self._log_debug("Summary: %s" % maybe_summary)
233 else: 233 else:
234 # Not a summary. Running the jar failed. Bail. 234 # Running the jar failed. Bail.
235 self._log_error(stderr) 235 self._log_error(stderr)
236 self._nuke_temp_files() 236 self._nuke_temp_files()
237 sys.exit(1) 237 sys.exit(1)
238 238
239 if errors and out_file: 239 if errors and out_file:
240 if os.path.exists(out_file): 240 if os.path.exists(out_file):
241 os.remove(out_file) 241 os.remove(out_file)
242 if os.path.exists(self._MAP_FILE_FORMAT % out_file): 242 if os.path.exists(self._MAP_FILE_FORMAT % out_file):
243 os.remove(self._MAP_FILE_FORMAT % out_file) 243 os.remove(self._MAP_FILE_FORMAT % out_file)
244 244
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 else: 373 else:
374 found_errors, stderr = checker.check_multiple( 374 found_errors, stderr = checker.check_multiple(
375 sources, 375 sources,
376 out_file=opts.out_file, 376 out_file=opts.out_file,
377 externs=externs, 377 externs=externs,
378 runner_args=opts.runner_args, 378 runner_args=opts.runner_args,
379 closure_args=opts.closure_args) 379 closure_args=opts.closure_args)
380 if found_errors: 380 if found_errors:
381 print stderr 381 print stderr
382 sys.exit(1) 382 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | third_party/closure_compiler/compile2.py » ('j') | third_party/closure_compiler/compile2.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698