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 |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 from xml.dom import minidom | 13 from xml.dom import minidom |
14 | 14 |
15 from util import build_utils # pylint: disable=F0401 | 15 from util import build_utils |
16 | 16 |
17 | 17 |
18 _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), | 18 _SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), |
19 '..', '..', '..')) | 19 '..', '..', '..')) |
20 | 20 |
21 | 21 |
22 def _RunLint(lint_path, config_path, processed_config_path, manifest_path, | 22 def _RunLint(lint_path, config_path, processed_config_path, manifest_path, |
23 result_path, product_dir, src_dirs, classes_dir): | 23 result_path, product_dir, src_dirs, classes_dir): |
24 | 24 |
25 def _RelativizePath(path): | 25 def _RelativizePath(path): |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 # Lint errors do not fail the build. | 113 # Lint errors do not fail the build. |
114 return 0 | 114 return 0 |
115 | 115 |
116 return 0 | 116 return 0 |
117 | 117 |
118 | 118 |
119 def main(): | 119 def main(argv): |
120 parser = optparse.OptionParser() | 120 parser = optparse.OptionParser() |
121 parser.add_option('--lint-path', help='Path to lint executable.') | 121 parser.add_option('--lint-path', help='Path to lint executable.') |
122 parser.add_option('--config-path', help='Path to lint suppressions file.') | 122 parser.add_option('--config-path', help='Path to lint suppressions file.') |
123 parser.add_option('--processed-config-path', | 123 parser.add_option('--processed-config-path', |
124 help='Path to processed lint suppressions file.') | 124 help='Path to processed lint suppressions file.') |
125 parser.add_option('--manifest-path', help='Path to AndroidManifest.xml') | 125 parser.add_option('--manifest-path', help='Path to AndroidManifest.xml') |
126 parser.add_option('--result-path', help='Path to XML lint result file.') | 126 parser.add_option('--result-path', help='Path to XML lint result file.') |
127 parser.add_option('--product-dir', help='Path to product dir.') | 127 parser.add_option('--product-dir', help='Path to product dir.') |
128 parser.add_option('--src-dirs', help='Directories containing java files.') | 128 parser.add_option('--src-dirs', help='Directories containing java files.') |
129 parser.add_option('--classes-dir', help='Directory containing class files.') | 129 parser.add_option('--classes-dir', help='Directory containing class files.') |
(...skipping 19 matching lines...) Expand all Loading... |
149 options.manifest_path, options.result_path, | 149 options.manifest_path, options.result_path, |
150 options.product_dir, src_dirs, options.classes_dir) | 150 options.product_dir, src_dirs, options.classes_dir) |
151 | 151 |
152 if options.stamp and not rc: | 152 if options.stamp and not rc: |
153 build_utils.Touch(options.stamp) | 153 build_utils.Touch(options.stamp) |
154 | 154 |
155 return rc | 155 return rc |
156 | 156 |
157 | 157 |
158 if __name__ == '__main__': | 158 if __name__ == '__main__': |
159 sys.exit(main()) | 159 sys.exit(main(sys.argv)) |
OLD | NEW |