diff options
author | michaelbai <michaelbai@chromium.org> | 2016-01-25 16:43:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-26 00:44:02 +0000 |
commit | e77d565e1b9a8d3a2822b54bbaee1d81f5a67198 (patch) | |
tree | f0b1b57c1ce5baa92f20ff39816262414d87e446 /build/android | |
parent | 48671daec4184675fe6fd61b43a9f8ee0d535ec4 (diff) | |
download | chromium_src-e77d565e1b9a8d3a2822b54bbaee1d81f5a67198.zip chromium_src-e77d565e1b9a8d3a2822b54bbaee1d81f5a67198.tar.gz chromium_src-e77d565e1b9a8d3a2822b54bbaee1d81f5a67198.tar.bz2 |
Support uncompress and page align shared libraries
This is no corresponding gyp change, because the ant apkbuilder
doesn't support uncompress shared libraries, to only have GN
support this meets our requirement.
BUG=579610
Review URL: https://codereview.chromium.org/1619553003
Cr-Commit-Position: refs/heads/master@{#371384}
Diffstat (limited to 'build/android')
-rwxr-xr-x | build/android/gyp/apkbuilder.py | 14 | ||||
-rwxr-xr-x | build/android/gyp/finalize_apk.py | 20 |
2 files changed, 30 insertions, 4 deletions
diff --git a/build/android/gyp/apkbuilder.py b/build/android/gyp/apkbuilder.py index 8278b2c..ca320f9 100755 --- a/build/android/gyp/apkbuilder.py +++ b/build/android/gyp/apkbuilder.py @@ -57,6 +57,9 @@ def _ParseArgs(args): default='[]') parser.add_argument('--emma-device-jar', help='Path to emma_device.jar to include.') + parser.add_argument('--uncompress-shared-libraries', + action='store_true', + help='Uncompress shared libraries') options = parser.parse_args(args) options.assets = build_utils.ParseGypList(options.assets) options.uncompressed_assets = build_utils.ParseGypList( @@ -206,7 +209,16 @@ def main(args): for path in native_libs: basename = os.path.basename(path) apk_path = 'lib/%s/%s' % (options.android_abi, basename) - build_utils.AddToZipHermetic(out_apk, apk_path, src_path=path) + + compress = None + if (options.uncompress_shared_libraries and + os.path.splitext(basename)[1] == '.so'): + compress = False + + build_utils.AddToZipHermetic(out_apk, + apk_path, + src_path=path, + compress=compress) for name in sorted(options.native_lib_placeholders): # Empty libs files are ignored by md5check, but rezip requires them diff --git a/build/android/gyp/finalize_apk.py b/build/android/gyp/finalize_apk.py index a6a1040..d71cb8f 100755 --- a/build/android/gyp/finalize_apk.py +++ b/build/android/gyp/finalize_apk.py @@ -55,10 +55,17 @@ def JarSigner(key_path, key_name, key_passwd, unsigned_path, signed_path): build_utils.CheckOutput(sign_cmd) -def AlignApk(zipalign_path, unaligned_path, final_path): +def AlignApk(zipalign_path, package_align, unaligned_path, final_path): align_cmd = [ zipalign_path, - '-f', '4', # 4 bytes + '-f' + ] + + if package_align: + align_cmd += ['-p'] + + align_cmd += [ + '4', # 4 bytes unaligned_path, final_path, ] @@ -74,6 +81,9 @@ def main(args): parser.add_option('--rezip-apk-jar-path', help='Path to the RezipApk jar file.') parser.add_option('--zipalign-path', help='Path to the zipalign tool.') + parser.add_option('--page-align-shared-libraries', + action='store_true', + help='Page align shared libraries.') parser.add_option('--unsigned-apk-path', help='Path to input unsigned APK.') parser.add_option('--final-apk-path', help='Path to output signed and aligned APK.') @@ -100,6 +110,7 @@ def main(args): options.load_library_from_zip, options.key_name, options.key_passwd, + options.page_align_shared_libraries, ] build_utils.CallAndWriteDepfileIfStale( @@ -140,7 +151,10 @@ def FinalizeApk(options): options.rezip_apk_jar_path, signed_apk_path, options.final_apk_path) else: # Align uncompressed items to 4 bytes - AlignApk(options.zipalign_path, signed_apk_path, options.final_apk_path) + AlignApk(options.zipalign_path, + options.page_align_shared_libraries, + signed_apk_path, + options.final_apk_path) if __name__ == '__main__': |