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

Side by Side Diff: build/android/gyp/lint.py

Issue 1922823002: [Android] Add documentation for lint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « build/android/docs/lint.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 argparse 10 import argparse
11 import os 11 import os
12 import re 12 import re
13 import sys 13 import sys
14 import traceback 14 import traceback
15 from xml.dom import minidom 15 from xml.dom import minidom
16 16
17 from util import build_utils 17 from util import build_utils
18 18
19 19 _LINT_MD_URL = 'https://chromium.googlesource.com/chromium/src/+/master/build/an droid/docs/lint.md' # pylint: disable=line-too-long
20 _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), 20 _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
21 '..', '..', '..')) 21 '..', '..', '..'))
22 22
23 23
24 def _OnStaleMd5(lint_path, config_path, processed_config_path, 24 def _OnStaleMd5(lint_path, config_path, processed_config_path,
25 manifest_path, result_path, product_dir, sources, jar_path, 25 manifest_path, result_path, product_dir, sources, jar_path,
26 cache_dir, android_sdk_version, resource_dir=None, 26 cache_dir, android_sdk_version, resource_dir=None,
27 classpath=None, can_fail_build=False, silent=False): 27 classpath=None, can_fail_build=False, silent=False):
28 def _RelativizePath(path): 28 def _RelativizePath(path):
29 """Returns relative path to top-level src dir. 29 """Returns relative path to top-level src dir.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 except Exception: # pylint: disable=broad-except 189 except Exception: # pylint: disable=broad-except
190 if not silent: 190 if not silent:
191 print 'Lint created unparseable xml file...' 191 print 'Lint created unparseable xml file...'
192 print 'File contents:' 192 print 'File contents:'
193 with open(result_path) as f: 193 with open(result_path) as f:
194 print f.read() 194 print f.read()
195 raise 195 raise
196 196
197 _ProcessResultFile() 197 _ProcessResultFile()
198 msg = ('\nLint found %d new issues.\n' 198 msg = ('\nLint found %d new issues.\n'
199 ' - For full explanation refer to %s\n' % 199 ' - For full explanation, please refer to %s\n'
200 ' - For more information about lint and how to fix lint issues,'
201 ' please refer to %s\n' %
200 (num_issues, 202 (num_issues,
201 _RelativizePath(result_path))) 203 _RelativizePath(result_path),
202 if config_path: 204 _LINT_MD_URL))
203 msg += (' - Wanna suppress these issues?\n'
204 ' 1. Read comment in %s\n'
205 ' 2. Run "python %s %s"\n' %
206 (_RelativizePath(config_path),
207 _RelativizePath(os.path.join(_SRC_ROOT, 'build', 'android',
208 'lint', 'suppress.py')),
209 _RelativizePath(result_path)))
210 if not silent: 205 if not silent:
211 print >> sys.stderr, msg 206 print >> sys.stderr, msg
212 if can_fail_build: 207 if can_fail_build:
213 raise Exception('Lint failed.') 208 raise Exception('Lint failed.')
214 209
215 210
216 def main(): 211 def main():
217 parser = argparse.ArgumentParser() 212 parser = argparse.ArgumentParser()
218 build_utils.AddDepfileOption(parser) 213 build_utils.AddDepfileOption(parser)
219 214
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 silent=args.silent), 312 silent=args.silent),
318 args, 313 args,
319 input_paths=input_paths, 314 input_paths=input_paths,
320 input_strings=input_strings, 315 input_strings=input_strings,
321 output_paths=output_paths, 316 output_paths=output_paths,
322 depfile_deps=classpath) 317 depfile_deps=classpath)
323 318
324 319
325 if __name__ == '__main__': 320 if __name__ == '__main__':
326 sys.exit(main()) 321 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/docs/lint.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698