Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: build/android/gyp/util/proguard_util.py

Issue 2928733002: android: Make proguard .flags file more diff-friendly (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if self._mapping: 156 if self._mapping:
157 inputs.append(self._mapping) 157 inputs.append(self._mapping)
158 if self._libraries: 158 if self._libraries:
159 inputs += self._libraries 159 inputs += self._libraries
160 if self._tested_apk_info_path: 160 if self._tested_apk_info_path:
161 inputs += [self._tested_apk_info_path] 161 inputs += [self._tested_apk_info_path]
162 return inputs 162 return inputs
163 163
164 def _WriteFlagsFile(self, out): 164 def _WriteFlagsFile(self, out):
165 # Quite useful for auditing proguard flags. 165 # Quite useful for auditing proguard flags.
166 for config in self._configs: 166 for config in sorted(self._configs):
167 out.write('#' * 80 + '\n') 167 out.write('#' * 80 + '\n')
168 out.write(config + '\n') 168 out.write(config + '\n')
169 out.write('#' * 80 + '\n') 169 out.write('#' * 80 + '\n')
170 with open(config) as config_file: 170 with open(config) as config_file:
171 out.write(config_file.read().rstrip()) 171 contents = config_file.read().rstrip()
172 # Remove numbers from generated rule comments to make file more
173 # diff'able.
174 contents = re.sub(r' #generated:\d+', '', contents)
175 out.write(contents)
172 out.write('\n\n') 176 out.write('\n\n')
173 out.write('#' * 80 + '\n') 177 out.write('#' * 80 + '\n')
174 out.write('Command-line\n') 178 out.write('Command-line\n')
175 out.write('#' * 80 + '\n') 179 out.write('#' * 80 + '\n')
176 out.write(' '.join(self._cmd) + '\n') 180 out.write(' '.join(self._cmd) + '\n')
177 181
178 def CheckOutput(self): 182 def CheckOutput(self):
179 self.build() 183 self.build()
180 # Proguard will skip writing these files if they would be empty. Create 184 # Proguard will skip writing these files if they would be empty. Create
181 # empty versions of them all now so that they are updated as the build 185 # empty versions of them all now so that they are updated as the build
(...skipping 19 matching lines...) Expand all
201 stderr_filter=stderr_filter) 205 stderr_filter=stderr_filter)
202 206
203 this_info = { 207 this_info = {
204 'inputs': self._injars, 208 'inputs': self._injars,
205 'configs': self._configs, 209 'configs': self._configs,
206 'mapping': self._outjar + '.mapping', 210 'mapping': self._outjar + '.mapping',
207 'elapsed_time': round(time.time() - start_time), 211 'elapsed_time': round(time.time() - start_time),
208 } 212 }
209 213
210 build_utils.WriteJson(this_info, self._outjar + '.info') 214 build_utils.WriteJson(this_info, self._outjar + '.info')
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698