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 logging | 5 import logging |
6 import os | 6 import os |
7 import xml.dom.minidom | 7 import xml.dom.minidom |
8 | 8 |
9 from devil.utils import cmd_helper | 9 from devil.utils import cmd_helper |
10 from pylib import constants | 10 from pylib import constants |
| 11 from pylib.constants import host_paths |
11 | 12 |
12 | 13 |
13 _FINDBUGS_HOME = os.path.join(constants.DIR_SOURCE_ROOT, 'third_party', | 14 _FINDBUGS_HOME = os.path.join(host_paths.DIR_SOURCE_ROOT, 'third_party', |
14 'findbugs') | 15 'findbugs') |
15 _FINDBUGS_JAR = os.path.join(_FINDBUGS_HOME, 'lib', 'findbugs.jar') | 16 _FINDBUGS_JAR = os.path.join(_FINDBUGS_HOME, 'lib', 'findbugs.jar') |
16 _FINDBUGS_MAX_HEAP = 768 | 17 _FINDBUGS_MAX_HEAP = 768 |
17 _FINDBUGS_PLUGIN_PATH = os.path.join( | 18 _FINDBUGS_PLUGIN_PATH = os.path.join( |
18 constants.DIR_SOURCE_ROOT, 'tools', 'android', 'findbugs_plugin', 'lib', | 19 host_paths.DIR_SOURCE_ROOT, 'tools', 'android', 'findbugs_plugin', 'lib', |
19 'chromiumPlugin.jar') | 20 'chromiumPlugin.jar') |
20 | 21 |
21 | 22 |
22 def _ParseXmlResults(results_doc): | 23 def _ParseXmlResults(results_doc): |
23 warnings = set() | 24 warnings = set() |
24 for en in (n for n in results_doc.documentElement.childNodes | 25 for en in (n for n in results_doc.documentElement.childNodes |
25 if n.nodeType == xml.dom.Node.ELEMENT_NODE): | 26 if n.nodeType == xml.dom.Node.ELEMENT_NODE): |
26 if en.tagName == 'BugInstance': | 27 if en.tagName == 'BugInstance': |
27 warnings.add(_ParseBugInstance(en)) | 28 warnings.add(_ParseBugInstance(en)) |
28 return warnings | 29 return warnings |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 _, raw_out, stderr = cmd_helper.GetCmdStatusOutputAndError(cmd) | 146 _, raw_out, stderr = cmd_helper.GetCmdStatusOutputAndError(cmd) |
146 results_doc = xml.dom.minidom.parseString(raw_out) | 147 results_doc = xml.dom.minidom.parseString(raw_out) |
147 | 148 |
148 for line in stderr.splitlines(): | 149 for line in stderr.splitlines(): |
149 logging.debug(' %s', line) | 150 logging.debug(' %s', line) |
150 | 151 |
151 current_warnings_set = _ParseXmlResults(results_doc) | 152 current_warnings_set = _ParseXmlResults(results_doc) |
152 | 153 |
153 return (' '.join(cmd), current_warnings_set) | 154 return (' '.join(cmd), current_warnings_set) |
154 | 155 |
OLD | NEW |