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

Unified Diff: build/android/resource_sizes.py

Issue 2608323002: Teach resource_sizes.py about webview_licenses.notice file (Closed)
Patch Set: Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/resource_sizes.py
diff --git a/build/android/resource_sizes.py b/build/android/resource_sizes.py
index 6df35fd84b6fb2dacfecd445ece5d5c97b3178d5..242ed83b437166bf63c00f50cce2fbcaf01e1cd5 100755
--- a/build/android/resource_sizes.py
+++ b/build/android/resource_sizes.py
@@ -180,6 +180,9 @@ class _FileGroup(object):
self._zip_infos.append(zip_info)
self._extracted.append(extracted)
+ def AllEntries(self):
+ return iter(self._zip_infos)
+
def GetNumEntries(self):
return len(self._zip_infos)
@@ -227,6 +230,7 @@ def PrintApkAnalysis(apk_filename, chartjson=None):
arsc = make_group('Compiled Android resources')
metadata = make_group('Package metadata')
unknown = make_group('Unknown files')
+ notices = make_group('licenses.notice file')
apk = zipfile.ZipFile(apk_filename, 'r')
try:
@@ -262,6 +266,8 @@ def PrintApkAnalysis(apk_filename, chartjson=None):
arsc.AddZipInfo(member)
elif filename.startswith('META-INF') or filename == 'AndroidManifest.xml':
metadata.AddZipInfo(member)
+ elif filename.endswith('.notice'):
+ notices.AddZipInfo(member)
else:
unknown.AddZipInfo(member)
@@ -318,6 +324,8 @@ def PrintApkAnalysis(apk_filename, chartjson=None):
# updated.
english_pak = translations.FindByPattern(r'.*/en[-_][Uu][Ss]\.l?pak')
if english_pak:
+ # TODO(agrieve): This should also analyze .arsc file to remove non-en
+ # configs. http://crbug.com/677966
normalized_apk_size -= translations.ComputeZippedSize()
# 1.17 found by looking at Chrome.apk and seeing how much smaller en-US.pak
# is relative to the average locale .pak.
@@ -330,6 +338,9 @@ def PrintApkAnalysis(apk_filename, chartjson=None):
ReportPerfResult(chartjson, apk_basename + '_Specifics',
'file count', len(apk_contents), 'zip entries')
+ for info in unknown.AllEntries():
+ print 'Unknown entry:', info.filename, info.compress_size
+
def IsPakFileName(file_name):
"""Returns whether the given file name ends with .pak or .lpak."""
« 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