| Index: build/android/gyp/lint.py
|
| diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py
|
| index 0aad9c5e1fb858db290fa8aab23a1fbe714305aa..e258c0a948ef1df185dd01e246cd1c599b0d8f57 100755
|
| --- a/build/android/gyp/lint.py
|
| +++ b/build/android/gyp/lint.py
|
| @@ -141,44 +141,61 @@ def _OnStaleMd5(changes, lint_path, config_path, processed_config_path,
|
| build_utils.CheckOutput(cmd, cwd=_SRC_ROOT, env=env or None,
|
| stderr_filter=stderr_filter)
|
| except build_utils.CalledProcessError:
|
| - if can_fail_build:
|
| - traceback.print_exc()
|
| -
|
| # There is a problem with lint usage
|
| if not os.path.exists(result_path):
|
| raise
|
|
|
| - # There are actual lint issues
|
| - else:
|
| - try:
|
| - num_issues = _ParseAndShowResultFile()
|
| - except Exception: # pylint: disable=broad-except
|
| - if not silent:
|
| - print 'Lint created unparseable xml file...'
|
| - print 'File contents:'
|
| - with open(result_path) as f:
|
| - print f.read()
|
| - if not can_fail_build:
|
| - return
|
| + # Sometimes produces empty (almost) files:
|
| + if os.path.getsize(result_path) < 10:
|
| + if can_fail_build:
|
| raise
|
| + elif not silent:
|
| + traceback.print_exc()
|
| + return
|
|
|
| - _ProcessResultFile()
|
| - msg = ('\nLint found %d new issues.\n'
|
| - ' - For full explanation refer to %s\n' %
|
| - (num_issues,
|
| - _RelativizePath(result_path)))
|
| - if config_path:
|
| - msg += (' - Wanna suppress these issues?\n'
|
| - ' 1. Read comment in %s\n'
|
| - ' 2. Run "python %s %s"\n' %
|
| - (_RelativizePath(config_path),
|
| - _RelativizePath(os.path.join(_SRC_ROOT, 'build', 'android',
|
| - 'lint', 'suppress.py')),
|
| - _RelativizePath(result_path)))
|
| + # There are actual lint issues
|
| + try:
|
| + num_issues = _ParseAndShowResultFile()
|
| + except Exception: # pylint: disable=broad-except
|
| if not silent:
|
| - print >> sys.stderr, msg
|
| - if can_fail_build:
|
| - raise Exception('Lint failed.')
|
| + print 'Lint created unparseable xml file...'
|
| + print 'File contents:'
|
| + with open(result_path) as f:
|
| + print f.read()
|
| + if not can_fail_build:
|
| + return
|
| +
|
| + if can_fail_build and not silent:
|
| + traceback.print_exc()
|
| +
|
| + # There are actual lint issues
|
| + try:
|
| + num_issues = _ParseAndShowResultFile()
|
| + except Exception: # pylint: disable=broad-except
|
| + if not silent:
|
| + print 'Lint created unparseable xml file...'
|
| + print 'File contents:'
|
| + with open(result_path) as f:
|
| + print f.read()
|
| + raise
|
| +
|
| + _ProcessResultFile()
|
| + msg = ('\nLint found %d new issues.\n'
|
| + ' - For full explanation refer to %s\n' %
|
| + (num_issues,
|
| + _RelativizePath(result_path)))
|
| + if config_path:
|
| + msg += (' - Wanna suppress these issues?\n'
|
| + ' 1. Read comment in %s\n'
|
| + ' 2. Run "python %s %s"\n' %
|
| + (_RelativizePath(config_path),
|
| + _RelativizePath(os.path.join(_SRC_ROOT, 'build', 'android',
|
| + 'lint', 'suppress.py')),
|
| + _RelativizePath(result_path)))
|
| + if not silent:
|
| + print >> sys.stderr, msg
|
| + if can_fail_build:
|
| + raise Exception('Lint failed.')
|
|
|
|
|
| def main():
|
|
|