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 from util import build_utils | 7 from util import build_utils |
8 | 8 |
9 | 9 |
10 class _ProguardOutputFilter(object): | 10 class _ProguardOutputFilter(object): |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 cmd += [ | 122 cmd += [ |
123 '-injars', ':'.join(self._injars) | 123 '-injars', ':'.join(self._injars) |
124 ] | 124 ] |
125 | 125 |
126 for config_file in self._configs: | 126 for config_file in self._configs: |
127 cmd += ['-include', config_file] | 127 cmd += ['-include', config_file] |
128 | 128 |
129 # The output jar must be specified after inputs. | 129 # The output jar must be specified after inputs. |
130 cmd += [ | 130 cmd += [ |
131 '-outjars', self._outjar, | 131 '-outjars', self._outjar, |
132 '-dump', self._outjar + '.dump', | |
133 '-printseeds', self._outjar + '.seeds', | 132 '-printseeds', self._outjar + '.seeds', |
134 '-printusage', self._outjar + '.usage', | 133 '-printusage', self._outjar + '.usage', |
135 '-printmapping', self._outjar + '.mapping', | 134 '-printmapping', self._outjar + '.mapping', |
136 ] | 135 ] |
137 | 136 |
138 if self._verbose: | 137 if self._verbose: |
139 cmd.append('-verbose') | 138 cmd.append('-verbose') |
140 | 139 |
141 self._cmd = cmd | 140 self._cmd = cmd |
142 return self._cmd | 141 return self._cmd |
143 | 142 |
144 def GetInputs(self): | 143 def GetInputs(self): |
145 self.build() | 144 self.build() |
146 inputs = [self._proguard_jar_path] + self._configs + self._injars | 145 inputs = [self._proguard_jar_path] + self._configs + self._injars |
147 if self._mapping: | 146 if self._mapping: |
148 inputs.append(self._mapping) | 147 inputs.append(self._mapping) |
149 if self._libraries: | 148 if self._libraries: |
150 inputs += self._libraries | 149 inputs += self._libraries |
151 if self._tested_apk_info_path: | 150 if self._tested_apk_info_path: |
152 inputs += [self._tested_apk_info_path] | 151 inputs += [self._tested_apk_info_path] |
153 return inputs | 152 return inputs |
154 | 153 |
155 | 154 |
156 def CheckOutput(self): | 155 def CheckOutput(self): |
157 self.build() | 156 self.build() |
158 # Proguard will skip writing these files if they would be empty. Create | 157 # Proguard will skip writing these files if they would be empty. Create |
159 # empty versions of them all now so that they are updated as the build | 158 # empty versions of them all now so that they are updated as the build |
160 # expects. | 159 # expects. |
161 open(self._outjar + '.dump', 'w').close() | |
162 open(self._outjar + '.seeds', 'w').close() | 160 open(self._outjar + '.seeds', 'w').close() |
163 open(self._outjar + '.usage', 'w').close() | 161 open(self._outjar + '.usage', 'w').close() |
164 open(self._outjar + '.mapping', 'w').close() | 162 open(self._outjar + '.mapping', 'w').close() |
165 # Warning: and Error: are sent to stderr, but messages and Note: are sent | 163 # Warning: and Error: are sent to stderr, but messages and Note: are sent |
166 # to stdout. | 164 # to stdout. |
167 stdout_filter = None | 165 stdout_filter = None |
168 stderr_filter = None | 166 stderr_filter = None |
169 if not self._verbose: | 167 if not self._verbose: |
170 stdout_filter = _ProguardOutputFilter() | 168 stdout_filter = _ProguardOutputFilter() |
171 stderr_filter = _ProguardOutputFilter() | 169 stderr_filter = _ProguardOutputFilter() |
172 build_utils.CheckOutput(self._cmd, print_stdout=True, | 170 build_utils.CheckOutput(self._cmd, print_stdout=True, |
173 print_stderr=True, | 171 print_stderr=True, |
174 stdout_filter=stdout_filter, | 172 stdout_filter=stdout_filter, |
175 stderr_filter=stderr_filter) | 173 stderr_filter=stderr_filter) |
176 | 174 |
177 this_info = { | 175 this_info = { |
178 'inputs': self._injars, | 176 'inputs': self._injars, |
179 'configs': self._configs, | 177 'configs': self._configs, |
180 'mapping': self._outjar + '.mapping', | 178 'mapping': self._outjar + '.mapping', |
181 } | 179 } |
182 | 180 |
183 build_utils.WriteJson(this_info, self._outjar + '.info') | 181 build_utils.WriteJson(this_info, self._outjar + '.info') |
184 | 182 |
OLD | NEW |