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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 if os.path.exists(result_path): | 115 if os.path.exists(result_path): |
116 os.remove(result_path) | 116 os.remove(result_path) |
117 | 117 |
118 try: | 118 try: |
119 build_utils.CheckOutput(cmd, cwd=_SRC_ROOT) | 119 build_utils.CheckOutput(cmd, cwd=_SRC_ROOT) |
120 except build_utils.CalledProcessError as e: | 120 except build_utils.CalledProcessError as e: |
121 # There is a problem with lint usage | 121 # There is a problem with lint usage |
122 if not os.path.exists(result_path): | 122 if not os.path.exists(result_path): |
123 print 'Something is wrong:' | 123 print 'Something is wrong:' |
124 print e | 124 print e |
125 return 0 | 125 return 1 |
newt (away)
2015/06/17 21:00:47
shouldn't we check the value of can_fail_build her
aurimas (slooooooooow)
2015/06/17 21:50:24
Done
| |
126 | 126 |
127 # There are actual lint issues | 127 # There are actual lint issues |
128 else: | 128 else: |
129 try: | 129 try: |
130 num_issues = _ParseAndShowResultFile() | 130 num_issues = _ParseAndShowResultFile() |
131 except Exception: | 131 except Exception: |
132 print 'Lint created unparseable xml file...' | 132 print 'Lint created unparseable xml file...' |
133 print 'File contents:' | 133 print 'File contents:' |
134 with open(result_path) as f: | 134 with open(result_path) as f: |
135 print f.read() | 135 print f.read() |
136 return 0 | 136 return 1 |
137 | 137 |
138 _ProcessResultFile() | 138 _ProcessResultFile() |
139 msg = ('\nLint found %d new issues.\n' | 139 msg = ('\nLint found %d new issues.\n' |
140 ' - For full explanation refer to %s\n' | 140 ' - For full explanation refer to %s\n' |
141 ' - Wanna suppress these issues?\n' | 141 ' - Wanna suppress these issues?\n' |
142 ' 1. Read comment in %s\n' | 142 ' 1. Read comment in %s\n' |
143 ' 2. Run "python %s %s"\n' % | 143 ' 2. Run "python %s %s"\n' % |
144 (num_issues, | 144 (num_issues, |
145 _RelativizePath(result_path), | 145 _RelativizePath(result_path), |
146 _RelativizePath(config_path), | 146 _RelativizePath(config_path), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 build_utils.GetPythonDependencies()) | 206 build_utils.GetPythonDependencies()) |
207 | 207 |
208 if options.stamp and not rc: | 208 if options.stamp and not rc: |
209 build_utils.Touch(options.stamp) | 209 build_utils.Touch(options.stamp) |
210 | 210 |
211 return rc | 211 return rc |
212 | 212 |
213 | 213 |
214 if __name__ == '__main__': | 214 if __name__ == '__main__': |
215 sys.exit(main()) | 215 sys.exit(main()) |
OLD | NEW |