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

Unified Diff: build/android/gyp/apkbuilder.py

Issue 1452843002: Use hermetic timestamps in apkbuilder.py and refactor helper function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 1 month 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 | build/android/gyp/java_cpp_enum.py » ('j') | build/android/gyp/util/build_utils.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/apkbuilder.py
diff --git a/build/android/gyp/apkbuilder.py b/build/android/gyp/apkbuilder.py
index c44173f0f941f21c179ebd68e4bdd4938206a17b..ffe4740da69e02755517bd4aeb66892b9bc47fb7 100755
--- a/build/android/gyp/apkbuilder.py
+++ b/build/android/gyp/apkbuilder.py
@@ -87,16 +87,13 @@ def _AddAssets(apk, paths, disable_compression=False):
"""
# Group all uncompressed assets together in the hope that it will increase
# locality of mmap'ed files.
- for target_compress_type in (zipfile.ZIP_STORED, zipfile.ZIP_DEFLATED):
+ for target_compress in (False, True):
for path in paths:
src_path, dest_path = _SplitAssetPath(path)
- compress_type = zipfile.ZIP_DEFLATED
- if disable_compression or (
- os.path.splitext(src_path)[1] in _NO_COMPRESS_EXTENSIONS):
- compress_type = zipfile.ZIP_STORED
-
- if target_compress_type == compress_type:
+ compress = not disable_compression and (
jbudorick 2015/11/17 14:15:15 nit: Can we flip this to enable_compression? I thi
agrieve 2015/11/18 20:36:34 Normally agree, but in this case I think it's a bi
+ os.path.splitext(src_path)[1] not in _NO_COMPRESS_EXTENSIONS)
+ if target_compress == compress:
apk_path = 'assets/' + dest_path
try:
apk.getinfo(apk_path)
@@ -104,7 +101,8 @@ def _AddAssets(apk, paths, disable_compression=False):
raise Exception('Multiple targets specified the asset path: %s' %
apk_path)
except KeyError:
- apk.write(src_path, apk_path, compress_type)
+ build_utils.AddToZipHermetic(apk, apk_path, src_path=src_path,
+ compress=compress)
def main(args):
@@ -140,13 +138,16 @@ def main(args):
_AddAssets(apk, options.uncompressed_assets, disable_compression=True)
for path in native_libs:
basename = os.path.basename(path)
- apk.write(path, 'lib/%s/%s' % (options.android_abi, basename))
+ apk_path = 'lib/%s/%s' % (options.android_abi, basename)
+ build_utils.AddToZipHermetic(apk, apk_path, src_path=path)
if options.create_placeholder_lib:
# Make it non-empty so that its checksum is non-zero and is not
# ignored by md5_check.
- apk.writestr('lib/%s/libplaceholder.so' % options.android_abi, ':-)')
+ apk_path = 'lib/%s/libplaceholder.so' % options.android_abi
+ build_utils.AddToZipHermetic(apk, apk_path, data=':)')
if options.dex_file:
- apk.write(options.dex_file, 'classes.dex')
+ build_utils.AddToZipHermetic(apk, 'classes.dex',
+ src_path=options.dex_file)
shutil.move(tmp_apk, options.output_apk)
finally:
« no previous file with comments | « no previous file | build/android/gyp/java_cpp_enum.py » ('j') | build/android/gyp/util/build_utils.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698