Index: build/android/gyp/lint.py |
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py |
index b326ba81caaf43b55de0b365ffdc4c75a6b45e5e..1e60c2e4d163d0b6f86680d6afe68f2923d155c1 100755 |
--- a/build/android/gyp/lint.py |
+++ b/build/android/gyp/lint.py |
@@ -19,9 +19,8 @@ |
'..', '..', '..')) |
-def _OnStaleMd5(changes, lint_path, config_path, processed_config_path, |
- manifest_path, result_path, product_dir, sources, jar_path, |
- resource_dir=None, can_fail_build=False): |
+def _RunLint(lint_path, config_path, processed_config_path, manifest_path, |
+ result_path, product_dir, sources, jar_path, resource_dir=None): |
def _RelativizePath(path): |
"""Returns relative path to top-level src dir. |
@@ -72,10 +71,6 @@ |
print >> sys.stderr, error_line.encode('utf-8') |
return len(issues) |
- if changes.AddedOrModifiedOnly(): |
- changed_paths = set(changes.IterChangedPaths()) |
- sources = [s for s in sources if s in changed_paths] |
- |
with build_utils.TempDir() as temp_dir: |
_ProcessConfigFile() |
@@ -126,7 +121,7 @@ |
if not os.path.exists(result_path): |
print 'Something is wrong:' |
print e |
- raise |
+ return 1 |
# There are actual lint issues |
else: |
@@ -137,7 +132,7 @@ |
print 'File contents:' |
with open(result_path) as f: |
print f.read() |
- raise |
+ return 1 |
_ProcessResultFile() |
msg = ('\nLint found %d new issues.\n' |
@@ -152,8 +147,9 @@ |
'lint', 'suppress.py')), |
_RelativizePath(result_path))) |
print >> sys.stderr, msg |
- if can_fail_build: |
- raise Exception('Lint failed.') |
+ return 1 |
+ |
+ return 0 |
def main(): |
@@ -185,6 +181,8 @@ |
'result_path', 'product_dir', |
'jar_path']) |
+ rc = 0 |
+ |
if options.enable: |
sources = [] |
if options.src_dirs: |
@@ -195,34 +193,21 @@ |
else: |
print 'One of --src-dirs or --java-files must be specified.' |
return 1 |
- |
- input_paths = [ |
- options.lint_path, |
- options.config_path, |
- options.manifest_path, |
- options.jar_path, |
- ] |
- input_paths.extend(sources) |
- if options.resource_dir: |
- input_paths.extend(build_utils.FindInDirectory(options.resource_dir, '*')) |
- |
- input_strings = [ options.processed_config_path ] |
- output_paths = [ options.result_path ] |
- |
- build_utils.CallAndWriteDepfileIfStale( |
- lambda changes: _OnStaleMd5(changes, options.lint_path, |
- options.config_path, |
- options.processed_config_path, |
- options.manifest_path, options.result_path, |
- options.product_dir, sources, |
- options.jar_path, |
- resource_dir=options.resource_dir, |
- can_fail_build=options.can_fail_build), |
- options, |
- input_paths=input_paths, |
- input_strings=input_strings, |
- output_paths=output_paths, |
- pass_changes=True) |
+ rc = _RunLint(options.lint_path, options.config_path, |
+ options.processed_config_path, |
+ options.manifest_path, options.result_path, |
+ options.product_dir, sources, options.jar_path, |
+ options.resource_dir) |
+ |
+ if options.depfile: |
+ build_utils.WriteDepfile( |
+ options.depfile, |
+ build_utils.GetPythonDependencies()) |
+ |
+ if options.stamp and not rc: |
+ build_utils.Touch(options.stamp) |
+ |
+ return rc if options.can_fail_build else 0 |
if __name__ == '__main__': |