diff options
author | yusufo@chromium.org <yusufo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-18 20:22:43 +0000 |
---|---|---|
committer | yusufo@chromium.org <yusufo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-18 20:22:43 +0000 |
commit | 58c14367739e0474218691c6935c86b225de77e7 (patch) | |
tree | 3199a62e510aa4e9b8b781d45fc68a2289398eaa | |
parent | 7cb6937f076a5e52ff43c074b9ae00926ffd5e67 (diff) | |
download | chromium_src-58c14367739e0474218691c6935c86b225de77e7.zip chromium_src-58c14367739e0474218691c6935c86b225de77e7.tar.gz chromium_src-58c14367739e0474218691c6935c86b225de77e7.tar.bz2 |
Finalize apk takes zipalign path as argument instead of hardcoding it
zipalign tool can be in sdk/tools or sdk/build-tools. This change looks
for the right place and uses that instead of having it hardcoded inside
android_sdk_root
BUG=364655
Review URL: https://codereview.chromium.org/238253015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264842 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | build/android/finalize_apk_action.gypi | 10 | ||||
-rwxr-xr-x | build/android/gyp/finalize_apk.py | 9 |
2 files changed, 13 insertions, 6 deletions
diff --git a/build/android/finalize_apk_action.gypi b/build/android/finalize_apk_action.gypi index afe9f1b..bfb7ccd 100644 --- a/build/android/finalize_apk_action.gypi +++ b/build/android/finalize_apk_action.gypi @@ -22,6 +22,14 @@ 'keystore_path%': '<(DEPTH)/build/android/ant/chromium-debug.keystore', 'keystore_name%': 'chromiumdebugkey', 'keystore_password%': 'chromium', + 'conditions': [ + # Webview doesn't use zipalign. + ['android_webview_build==0', { + 'zipalign_path%': ['<!@(find <(android_sdk_root) -name zipalign)'], + }, { + 'zipalign_path%': "", + }], + ], }, 'inputs': [ '<(DEPTH)/build/android/gyp/util/build_utils.py', @@ -34,7 +42,7 @@ ], 'action': [ 'python', '<(DEPTH)/build/android/gyp/finalize_apk.py', - '--android-sdk-root=<(android_sdk_root)', + '--zipalign-path=<(zipalign_path)', '--unsigned-apk-path=<(input_apk_path)', '--final-apk-path=<(output_apk_path)', '--key-path=<(keystore_path)', diff --git a/build/android/gyp/finalize_apk.py b/build/android/gyp/finalize_apk.py index 9759097..d64e10d 100755 --- a/build/android/gyp/finalize_apk.py +++ b/build/android/gyp/finalize_apk.py @@ -8,7 +8,6 @@ """ import optparse -import os import shutil import sys import tempfile @@ -29,9 +28,9 @@ def SignApk(key_path, key_name, key_passwd, unsigned_path, signed_path): build_utils.CheckOutput(sign_cmd) -def AlignApk(android_sdk_root, unaligned_path, final_path): +def AlignApk(zipalign_path, unaligned_path, final_path): align_cmd = [ - os.path.join(android_sdk_root, 'tools', 'zipalign'), + zipalign_path, '-f', '4', # 4 bytes unaligned_path, final_path, @@ -42,7 +41,7 @@ def AlignApk(android_sdk_root, unaligned_path, final_path): def main(): parser = optparse.OptionParser() - parser.add_option('--android-sdk-root', help='Android sdk root directory.') + parser.add_option('--zipalign-path', help='Path to the zipalign tool.') 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.') @@ -57,7 +56,7 @@ def main(): signed_apk_path = intermediate_file.name SignApk(options.key_path, options.key_name, options.key_passwd, options.unsigned_apk_path, signed_apk_path) - AlignApk(options.android_sdk_root, signed_apk_path, options.final_apk_path) + AlignApk(options.zipalign_path, signed_apk_path, options.final_apk_path) if options.stamp: build_utils.Touch(options.stamp) |