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|.*:.*(?:MANIFEST\.MF|\.empty))') |
19 | 19 |
20 def __init__(self): | 20 def __init__(self): |
21 self._last_line_ignored = False | 21 self._last_line_ignored = False |
22 self._to_ignore_next_line = False | |
agrieve
2017/04/04 20:05:51
nit: _to_ignore_next_line -> _ignore_next_line
F
2017/04/04 20:38:07
Done.
| |
22 | 23 |
23 def __call__(self, output): | 24 def __call__(self, output): |
24 ret = [] | 25 ret = [] |
25 for line in output.splitlines(True): | 26 for line in output.splitlines(True): |
27 if self._to_ignore_next_line: | |
28 self._to_ignore_next_line = False | |
29 continue | |
30 | |
26 if not line.startswith(' '): | 31 if not line.startswith(' '): |
27 self._last_line_ignored = bool(self.IGNORE_RE.match(line)) | 32 self._last_line_ignored = bool(self.IGNORE_RE.match(line)) |
28 elif 'You should check if you need to specify' in line: | 33 elif 'You should check if you need to specify' in line: |
29 self._last_line_ignored = True | 34 self._last_line_ignored = True |
35 elif '***BINARY RUN STATS***' in line: | |
36 self._last_line_ignored = True | |
37 self._to_ignore_next_line = True | |
30 | 38 |
31 if not self._last_line_ignored: | 39 if not self._last_line_ignored: |
32 ret.append(line) | 40 ret.append(line) |
33 return ''.join(ret) | 41 return ''.join(ret) |
34 | 42 |
35 | 43 |
36 class ProguardCmdBuilder(object): | 44 class ProguardCmdBuilder(object): |
37 def __init__(self, proguard_jar): | 45 def __init__(self, proguard_jar): |
38 assert os.path.exists(proguard_jar) | 46 assert os.path.exists(proguard_jar) |
39 self._proguard_jar_path = proguard_jar | 47 self._proguard_jar_path = proguard_jar |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 | 201 |
194 this_info = { | 202 this_info = { |
195 'inputs': self._injars, | 203 'inputs': self._injars, |
196 'configs': self._configs, | 204 'configs': self._configs, |
197 'mapping': self._outjar + '.mapping', | 205 'mapping': self._outjar + '.mapping', |
198 'elapsed_time': round(time.time() - start_time), | 206 'elapsed_time': round(time.time() - start_time), |
199 } | 207 } |
200 | 208 |
201 build_utils.WriteJson(this_info, self._outjar + '.info') | 209 build_utils.WriteJson(this_info, self._outjar + '.info') |
202 | 210 |
OLD | NEW |