Index: build.py |
=================================================================== |
--- a/build.py |
+++ b/build.py |
@@ -4,6 +4,7 @@ |
import json |
import os |
import shutil |
+import string |
import subprocess |
import sys |
import tempfile |
@@ -16,8 +17,11 @@ |
"obj-arm-linux-androideabi", "dist") |
def print_usage(): |
- print >>sys.stderr, "Usage: %s devbuild|release" % \ |
- os.path.basename(sys.argv[0]) |
+ print >>sys.stderr, string.Template("""\ |
+Usage: $name build devbuild|release |
+ $name sign APK_PATH |
+ $name build-and-sign devbuild|release\ |
+""").substitute({"name": os.path.basename(sys.argv[0])}) |
def check_mozconfig(path, mode): |
if not os.path.exists(path): |
@@ -85,16 +89,33 @@ |
os.remove(temp_apk_path) |
if __name__ == "__main__": |
- if len(sys.argv) < 2: |
+ if len(sys.argv) < 3: |
print_usage() |
sys.exit(1) |
mode = sys.argv[1] |
- if mode not in ("devbuild", "release"): |
+ do_build = mode in ("build", "build-and-sign") |
+ do_sign = mode in ("sign", "build-and-sign") |
+ if not do_build and not do_sign: |
print_usage() |
sys.exit(2) |
+ if do_build: |
+ build_mode = sys.argv[2] |
+ if build_mode not in ("devbuild", "release"): |
+ print_usage() |
+ sys.exit(3) |
+ |
+ if do_sign: |
+ apk_path = sys.argv[2] |
+ |
subprocess.check_call([ENSURE_DEPENDENCIES_PATH]) |
import config |
- apk_path = build(mode, config.ANDROID_SDK_PATH, config.ANDROID_NDK_PATH) |
- sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |
+ |
+ if do_build: |
+ apk_path = build(build_mode, config.ANDROID_SDK_PATH, |
+ config.ANDROID_NDK_PATH) |
+ if do_sign: |
+ sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |
+ else: |
René Jeschke
2015/08/13 08:01:52
Nit: this (and the next line) could be removed, as
|
+ print apk_path |