| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 import optparse | 7 import optparse |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import shlex | 10 import shlex |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 with file(known_bugs_file, 'w') as known_bugs: | 65 with file(known_bugs_file, 'w') as known_bugs: |
| 66 for warning in sorted(current_warnings_set): | 66 for warning in sorted(current_warnings_set): |
| 67 print >>known_bugs, warning | 67 print >>known_bugs, warning |
| 68 return 0 | 68 return 0 |
| 69 | 69 |
| 70 | 70 |
| 71 def _GetChromeClasses(release_version): | 71 def _GetChromeClasses(release_version): |
| 72 version = 'Debug' | 72 version = 'Debug' |
| 73 if release_version: | 73 if release_version: |
| 74 version = 'Release' | 74 version = 'Release' |
| 75 path = os.path.join(constants.CHROME_DIR, 'out', version) | 75 path = os.path.join(constants.DIR_SOURCE_ROOT, 'out', version) |
| 76 cmd = 'find %s -name "*.class"' % path | 76 cmd = 'find %s -name "*.class"' % path |
| 77 out = cmd_helper.GetCmdOutput(shlex.split(cmd)) | 77 out = cmd_helper.GetCmdOutput(shlex.split(cmd)) |
| 78 if not out: | 78 if not out: |
| 79 print 'No classes found in %s' % path | 79 print 'No classes found in %s' % path |
| 80 return out | 80 return out |
| 81 | 81 |
| 82 | 82 |
| 83 def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, | 83 def _Run(exclude, known_bugs, classes_to_analyze, auxiliary_classes, |
| 84 rebaseline, release_version, findbug_args): | 84 rebaseline, release_version, findbug_args): |
| 85 """Run the FindBugs. | 85 """Run the FindBugs. |
| 86 | 86 |
| 87 Args: | 87 Args: |
| 88 exclude: the exclude xml file, refer to FindBugs's -exclude command option. | 88 exclude: the exclude xml file, refer to FindBugs's -exclude command option. |
| 89 known_bugs: the text file of known bugs. The bugs in it will not be | 89 known_bugs: the text file of known bugs. The bugs in it will not be |
| 90 reported. | 90 reported. |
| 91 classes_to_analyze: the list of classes need to analyze, refer to FindBug's | 91 classes_to_analyze: the list of classes need to analyze, refer to FindBug's |
| 92 -onlyAnalyze command line option. | 92 -onlyAnalyze command line option. |
| 93 auxiliary_classes: the classes help to analyze, refer to FindBug's | 93 auxiliary_classes: the classes help to analyze, refer to FindBug's |
| 94 -auxclasspath command line option. | 94 -auxclasspath command line option. |
| 95 rebaseline: True if the known_bugs file needs rebaseline. | 95 rebaseline: True if the known_bugs file needs rebaseline. |
| 96 release_version: True if the release version needs check, otherwise check | 96 release_version: True if the release version needs check, otherwise check |
| 97 debug version. | 97 debug version. |
| 98 findbug_args: addtional command line options needs pass to Findbugs. | 98 findbug_args: addtional command line options needs pass to Findbugs. |
| 99 """ | 99 """ |
| 100 | 100 |
| 101 chrome_src = constants.CHROME_DIR | 101 chrome_src = constants.DIR_SOURCE_ROOT |
| 102 sdk_root = constants.ANDROID_SDK_ROOT | 102 sdk_root = constants.ANDROID_SDK_ROOT |
| 103 sdk_version = constants.ANDROID_SDK_VERSION | 103 sdk_version = constants.ANDROID_SDK_VERSION |
| 104 | 104 |
| 105 system_classes = [] | 105 system_classes = [] |
| 106 system_classes.append(os.path.join(sdk_root, 'platforms', | 106 system_classes.append(os.path.join(sdk_root, 'platforms', |
| 107 'android-%s' % sdk_version, 'android.jar')) | 107 'android-%s' % sdk_version, 'android.jar')) |
| 108 if auxiliary_classes: | 108 if auxiliary_classes: |
| 109 for classes in auxiliary_classes: | 109 for classes in auxiliary_classes: |
| 110 system_classes.append(os.path.abspath(classes)) | 110 system_classes.append(os.path.abspath(classes)) |
| 111 | 111 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 def main(argv): | 225 def main(argv): |
| 226 parser = GetCommonParser() | 226 parser = GetCommonParser() |
| 227 options, _ = parser.parse_args() | 227 options, _ = parser.parse_args() |
| 228 | 228 |
| 229 return Run(options) | 229 return Run(options) |
| 230 | 230 |
| 231 | 231 |
| 232 if __name__ == '__main__': | 232 if __name__ == '__main__': |
| 233 sys.exit(main(sys.argv)) | 233 sys.exit(main(sys.argv)) |
| OLD | NEW |