OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import optparse | 5 import optparse |
6 import os | 6 import os |
7 import re | 7 import re |
8 import shlex | 8 import shlex |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 return count | 59 return count |
60 | 60 |
61 | 61 |
62 def _Rebaseline(current_warnings_set, known_bugs_file): | 62 def _Rebaseline(current_warnings_set, known_bugs_file): |
63 with file(known_bugs_file, 'w') as known_bugs: | 63 with file(known_bugs_file, 'w') as known_bugs: |
64 for warning in sorted(current_warnings_set): | 64 for warning in sorted(current_warnings_set): |
65 print >> known_bugs, warning | 65 print >> known_bugs, warning |
66 return 0 | 66 return 0 |
67 | 67 |
68 | 68 |
69 def _GetChromeClasses(release_version): | 69 def _GetChromeClasses(release_version): |
newt (away)
2014/08/11 22:00:11
Consider renaming this to _GetChromeJars()?
cjhopman
2014/08/12 02:02:43
Done.
| |
70 version = 'Debug' | 70 version = 'Debug' |
71 if release_version: | 71 if release_version: |
72 version = 'Release' | 72 version = 'Release' |
73 path = os.path.join(constants.DIR_SOURCE_ROOT, 'out', version) | 73 path = os.path.join(constants.DIR_SOURCE_ROOT, 'out', version, 'lib.java') |
74 cmd = 'find %s -name "*.class"' % path | 74 cmd = 'find %s -name "*.jar"' % path |
75 out = cmd_helper.GetCmdOutput(shlex.split(cmd)) | 75 out = cmd_helper.GetCmdOutput(shlex.split(cmd)) |
76 out = [p for p in out.splitlines() if not p.endswith('.dex.jar')] | |
76 if not out: | 77 if not out: |
77 print 'No classes found in %s' % path | 78 print 'No classes found in %s' % path |
78 return out | 79 return ' '.join(out) |
79 | 80 |
80 | 81 |
81 def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, | 82 def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, |
82 rebaseline, release_version, findbug_args): | 83 rebaseline, release_version, findbug_args): |
83 """Run the FindBugs. | 84 """Run the FindBugs. |
84 | 85 |
85 Args: | 86 Args: |
86 exclude: the exclude xml file, refer to FindBugs's -exclude command option. | 87 exclude: the exclude xml file, refer to FindBugs's -exclude command option. |
87 known_bugs: the text file of known bugs. The bugs in it will not be | 88 known_bugs: the text file of known bugs. The bugs in it will not be |
88 reported. | 89 reported. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 | 233 |
233 def main(): | 234 def main(): |
234 parser = GetCommonParser() | 235 parser = GetCommonParser() |
235 options, _ = parser.parse_args() | 236 options, _ = parser.parse_args() |
236 | 237 |
237 return Run(options) | 238 return Run(options) |
238 | 239 |
239 | 240 |
240 if __name__ == '__main__': | 241 if __name__ == '__main__': |
241 sys.exit(main()) | 242 sys.exit(main()) |
OLD | NEW |