Index: build.py |
=================================================================== |
--- a/build.py |
+++ b/build.py |
@@ -97,27 +97,32 @@ def _build(architecture, distribution_mo |
shutil.copyfile(apk_path, target_apk_path) |
target_manifest_path = re.sub(r".apk$", ".json", target_apk_path) |
shutil.copyfile(manifest_path, target_manifest_path) |
return target_apk_path |
-def _sign(apk_path, key_store, key_name): |
+def _sign(apk_path, key_store, key_name, sdk_path): |
+ sys.path.append(os.path.join(_ABB_PATH, "python", "mozboot", "mozboot")) |
+ from android import ANDROID_BUILD_TOOLS_VERSION |
+ zipalign_path = os.path.join(sdk_path, "build-tools", |
+ ANDROID_BUILD_TOOLS_VERSION, "zipalign") |
temp_apk_path = tempfile.NamedTemporaryFile().name |
shutil.copyfile(apk_path, temp_apk_path) |
try: |
subprocess.check_call(["jarsigner", "-verbose", |
"-sigalg", "SHA1withRSA", |
"-digestalg", "SHA1", |
"-keystore", key_store, |
temp_apk_path, key_name]) |
os.remove(apk_path) |
- subprocess.check_call(["zipalign", "-v", "4", temp_apk_path, apk_path]) |
+ subprocess.check_call([zipalign_path, "-v", "4", temp_apk_path, |
+ apk_path]) |
finally: |
os.remove(temp_apk_path) |
if __name__ == "__main__": |
if len(sys.argv) < 2: |
print_usage() |
sys.exit(1) |
@@ -155,11 +160,12 @@ if __name__ == "__main__": |
print >>sys.stderr, error_msg % ( |
"architecture", "architectures", _ARCHS) |
sys.exit(6) |
if do_build: |
apk_path = _build(architecture, distribution_mode, build_mode, |
config.ANDROID_SDK_PATH, config.ANDROID_NDK_PATH) |
if do_sign: |
- _sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |
+ _sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME, |
+ config.ANDROID_SDK_PATH) |
else: |
print apk_path |