OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 os | 5 import os |
6 import re | 6 import re |
7 import time | 7 import time |
8 from util import build_utils | 8 from util import build_utils |
9 | 9 |
10 | 10 |
11 class _ProguardOutputFilter(object): | 11 class _ProguardOutputFilter(object): |
12 """ProGuard outputs boring stuff to stdout (proguard version, jar path, etc) | 12 """ProGuard outputs boring stuff to stdout (proguard version, jar path, etc) |
13 as well as interesting stuff (notes, warnings, etc). If stdout is entirely | 13 as well as interesting stuff (notes, warnings, etc). If stdout is entirely |
14 boring, this class suppresses the output. | 14 boring, this class suppresses the output. |
15 """ | 15 """ |
16 | 16 |
17 IGNORE_RE = re.compile( | 17 IGNORE_RE = re.compile( |
18 r'(?:Pro.*version|Note:|Reading|Preparing|.*:.*(?:MANIFEST\.MF|\.empty))') | 18 r'(?:Pro.*version|Note:|Reading|Preparing|ProgramClass:|' |
| 19 '.*:.*(?:MANIFEST\.MF|\.empty))') |
19 | 20 |
20 def __init__(self): | 21 def __init__(self): |
21 self._last_line_ignored = False | 22 self._last_line_ignored = False |
| 23 self._ignore_next_line = False |
22 | 24 |
23 def __call__(self, output): | 25 def __call__(self, output): |
24 ret = [] | 26 ret = [] |
25 for line in output.splitlines(True): | 27 for line in output.splitlines(True): |
26 if not line.startswith(' '): | 28 if self._ignore_next_line: |
| 29 self._ignore_next_line = False |
| 30 continue |
| 31 |
| 32 if '***BINARY RUN STATS***' in line: |
| 33 self._last_line_ignored = True |
| 34 self._ignore_next_line = True |
| 35 elif not line.startswith(' '): |
27 self._last_line_ignored = bool(self.IGNORE_RE.match(line)) | 36 self._last_line_ignored = bool(self.IGNORE_RE.match(line)) |
28 elif 'You should check if you need to specify' in line: | 37 elif 'You should check if you need to specify' in line: |
29 self._last_line_ignored = True | 38 self._last_line_ignored = True |
30 | 39 |
31 if not self._last_line_ignored: | 40 if not self._last_line_ignored: |
32 ret.append(line) | 41 ret.append(line) |
33 return ''.join(ret) | 42 return ''.join(ret) |
34 | 43 |
35 | 44 |
36 class ProguardCmdBuilder(object): | 45 class ProguardCmdBuilder(object): |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 stderr_filter=stderr_filter) | 201 stderr_filter=stderr_filter) |
193 | 202 |
194 this_info = { | 203 this_info = { |
195 'inputs': self._injars, | 204 'inputs': self._injars, |
196 'configs': self._configs, | 205 'configs': self._configs, |
197 'mapping': self._outjar + '.mapping', | 206 'mapping': self._outjar + '.mapping', |
198 'elapsed_time': round(time.time() - start_time), | 207 'elapsed_time': round(time.time() - start_time), |
199 } | 208 } |
200 | 209 |
201 build_utils.WriteJson(this_info, self._outjar + '.info') | 210 build_utils.WriteJson(this_info, self._outjar + '.info') |
202 | |
OLD | NEW |