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

Side by Side Diff: build/android/resource_sizes.py

Issue 2804623003: [Android] Fix resource_sizes for APKs that have no native library. (Closed)
Patch Set: Created 3 years, 8 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Prints the size of each given file and optionally computes the size of 6 """Prints the size of each given file and optionally computes the size of
7 libchrome.so without the dependencies added for building with android NDK. 7 libchrome.so without the dependencies added for building with android NDK.
8 Also breaks down the contents of the APK to determine the installed size 8 Also breaks down the contents of the APK to determine the installed size
9 and assign size contributions to different classes of file. 9 and assign size contributions to different classes of file.
10 """ 10 """
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return iter(self._zip_infos) 292 return iter(self._zip_infos)
293 293
294 def GetNumEntries(self): 294 def GetNumEntries(self):
295 return len(self._zip_infos) 295 return len(self._zip_infos)
296 296
297 def FindByPattern(self, pattern): 297 def FindByPattern(self, pattern):
298 return next((i for i in self._zip_infos if re.match(pattern, i.filename)), 298 return next((i for i in self._zip_infos if re.match(pattern, i.filename)),
299 None) 299 None)
300 300
301 def FindLargest(self): 301 def FindLargest(self):
302 if not self._zip_infos:
303 return None
302 return max(self._zip_infos, key=lambda i: i.file_size) 304 return max(self._zip_infos, key=lambda i: i.file_size)
303 305
304 def ComputeZippedSize(self): 306 def ComputeZippedSize(self):
305 return sum(i.compress_size for i in self._zip_infos) 307 return sum(i.compress_size for i in self._zip_infos)
306 308
307 def ComputeUncompressedSize(self): 309 def ComputeUncompressedSize(self):
308 return sum(i.file_size for i in self._zip_infos) 310 return sum(i.file_size for i in self._zip_infos)
309 311
310 def ComputeExtractedSize(self): 312 def ComputeExtractedSize(self):
311 ret = 0 313 ret = 0
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 args.apk, tools_prefix, chartjson=chartjson) 782 args.apk, tools_prefix, chartjson=chartjson)
781 if chartjson: 783 if chartjson:
782 results_path = os.path.join(args.output_dir, 'results-chart.json') 784 results_path = os.path.join(args.output_dir, 'results-chart.json')
783 logging.critical('Dumping json to %s', results_path) 785 logging.critical('Dumping json to %s', results_path)
784 with open(results_path, 'w') as json_file: 786 with open(results_path, 'w') as json_file:
785 json.dump(chartjson, json_file) 787 json.dump(chartjson, json_file)
786 788
787 789
788 if __name__ == '__main__': 790 if __name__ == '__main__':
789 sys.exit(main()) 791 sys.exit(main())
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