| Index: build.py |
| =================================================================== |
| --- a/build.py |
| +++ b/build.py |
| @@ -18,12 +18,12 @@ |
| def print_usage(): |
| print >>sys.stderr, string.Template("""\ |
| -Usage: $name build devbuild|release |
| +Usage: $name build devbuild|release standalone|store |
| $name sign APK_PATH |
| - $name build-and-sign devbuild|release\ |
| + $name build-and-sign devbuild|release standalone|store\ |
| """).substitute({"name": os.path.basename(sys.argv[0])}) |
| -def check_mozconfig(path, mode): |
| +def check_mozconfig(path, distribution_mode): |
| if not os.path.exists(path): |
| raise Exception("'%s' doesn't exist, please create it." % path) |
| @@ -41,9 +41,9 @@ |
| "'%s' doesn't seem to export MOZILLA_OFFICIAL=1, please do." % path) |
| updater_disabled = "--disable-updater" in contents |
| - if updater_disabled and mode == "devbuild": |
| + if updater_disabled and distribution_mode == "standalone": |
| raise Exception("'%s' seems to set --disable-updater, please don't." % path) |
| - elif not updater_disabled and mode == "release": |
| + elif not updater_disabled and distribution_mode == "store": |
| raise Exception( |
| "'%s' doesn't seem to set --disable-updater, please do." % path) |
| @@ -52,9 +52,9 @@ |
| check_mozconfig(mozconfig_path, mode) |
| return mozconfig_path |
| -def build(mode, sdk_path, ndk_path): |
| +def build(build_mode, distribution_mode, sdk_path, ndk_path): |
| mozharness_environment = os.environ.copy() |
| - mozharness_environment["MOZCONFIG"] = find_mozconfig(mode) |
| + mozharness_environment["MOZCONFIG"] = find_mozconfig(distribution_mode) |
| mozharness_environment["ANDROID_SDK_PATH"] = sdk_path |
| mozharness_environment["ANDROID_NDK_PATH"] = ndk_path |
| @@ -67,7 +67,7 @@ |
| manifest = json.load(manifest_file) |
| apk_path = os.path.join(DIST_PATH, "gecko-unsigned-unaligned.apk") |
| - if mode == "release": |
| + if build_mode == "release": |
| target_apk_name = "adblockbrowser-%s-arm.apk" % manifest["moz_app_version"] |
| else: |
| target_apk_name = "adblockbrowser-%s.%s-arm.apk" % ( |
| @@ -105,6 +105,10 @@ |
| if build_mode not in ("devbuild", "release"): |
| print_usage() |
| sys.exit(3) |
| + distribution_mode = len(sys.argv) > 3 and sys.argv[3] or "" |
| + if distribution_mode not in ("standalone", "store"): |
| + print_usage() |
| + sys.exit(4) |
| if do_sign: |
| apk_path = sys.argv[2] |
| @@ -113,7 +117,7 @@ |
| import config |
| if do_build: |
| - apk_path = build(build_mode, config.ANDROID_SDK_PATH, |
| + apk_path = build(build_mode, distribution_mode, config.ANDROID_SDK_PATH, |
| config.ANDROID_NDK_PATH) |
| if do_sign: |
| sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME) |