OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Runs Android's lint tool.""" | 7 """Runs Android's lint tool.""" |
8 | 8 |
9 | 9 |
10 import optparse | 10 import optparse |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 print >> sys.stderr, error | 69 print >> sys.stderr, error |
70 for attr in ['errorLine1', 'errorLine2']: | 70 for attr in ['errorLine1', 'errorLine2']: |
71 error_line = issue.getAttribute(attr) | 71 error_line = issue.getAttribute(attr) |
72 if error_line: | 72 if error_line: |
73 print >> sys.stderr, error_line | 73 print >> sys.stderr, error_line |
74 return len(issues) | 74 return len(issues) |
75 | 75 |
76 _ProcessConfigFile() | 76 _ProcessConfigFile() |
77 | 77 |
78 cmd = [ | 78 cmd = [ |
79 lint_path, '-Werror', '--exitcode', '--showall', | 79 lint_path, '--nowarn', '--exitcode', '--showall', |
80 '--config', _RelativizePath(processed_config_path), | 80 '--config', _RelativizePath(processed_config_path), |
81 '--classpath', _RelativizePath(classes_dir), | 81 '--classpath', _RelativizePath(classes_dir), |
82 '--xml', _RelativizePath(result_path), | 82 '--xml', _RelativizePath(result_path), |
83 ] | 83 ] |
84 for src in src_dirs: | 84 for src in src_dirs: |
85 cmd.extend(['--sources', _RelativizePath(src)]) | 85 cmd.extend(['--sources', _RelativizePath(src)]) |
86 cmd.append(_RelativizePath(os.path.join(manifest_path, os.pardir))) | 86 cmd.append(_RelativizePath(os.path.join(manifest_path, os.pardir))) |
87 | 87 |
88 if os.path.exists(result_path): | 88 if os.path.exists(result_path): |
89 os.remove(result_path) | 89 os.remove(result_path) |
(...skipping 13 matching lines...) Expand all Loading... |
103 ' - Wanna suppress these issues?\n' | 103 ' - Wanna suppress these issues?\n' |
104 ' 1. Read comment in %s\n' | 104 ' 1. Read comment in %s\n' |
105 ' 2. Run "python %s %s"\n' % | 105 ' 2. Run "python %s %s"\n' % |
106 (num_issues, | 106 (num_issues, |
107 _RelativizePath(result_path), | 107 _RelativizePath(result_path), |
108 _RelativizePath(config_path), | 108 _RelativizePath(config_path), |
109 _RelativizePath(os.path.join(_SRC_ROOT, 'build', 'android', | 109 _RelativizePath(os.path.join(_SRC_ROOT, 'build', 'android', |
110 'lint', 'suppress.py')), | 110 'lint', 'suppress.py')), |
111 _RelativizePath(result_path))) | 111 _RelativizePath(result_path))) |
112 print >> sys.stderr, msg | 112 print >> sys.stderr, msg |
113 return 1 | 113 # Lint errors do not fail the build. |
| 114 return 0 |
114 | 115 |
115 return 0 | 116 return 0 |
116 | 117 |
117 | 118 |
118 def main(argv): | 119 def main(argv): |
119 parser = optparse.OptionParser() | 120 parser = optparse.OptionParser() |
120 parser.add_option('--lint-path', help='Path to lint executable.') | 121 parser.add_option('--lint-path', help='Path to lint executable.') |
121 parser.add_option('--config-path', help='Path to lint suppressions file.') | 122 parser.add_option('--config-path', help='Path to lint suppressions file.') |
122 parser.add_option('--processed-config-path', | 123 parser.add_option('--processed-config-path', |
123 help='Path to processed lint suppressions file.') | 124 help='Path to processed lint suppressions file.') |
(...skipping 25 matching lines...) Expand all Loading... |
149 options.product_dir, src_dirs, options.classes_dir) | 150 options.product_dir, src_dirs, options.classes_dir) |
150 | 151 |
151 if options.stamp and not rc: | 152 if options.stamp and not rc: |
152 build_utils.Touch(options.stamp) | 153 build_utils.Touch(options.stamp) |
153 | 154 |
154 return rc | 155 return rc |
155 | 156 |
156 | 157 |
157 if __name__ == '__main__': | 158 if __name__ == '__main__': |
158 sys.exit(main(sys.argv)) | 159 sys.exit(main(sys.argv)) |
OLD | NEW |