| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 import glob | 3 import glob |
| 4 import json | 4 import json |
| 5 import os | 5 import os |
| 6 import re | 6 import re |
| 7 import shutil | 7 import shutil |
| 8 import string | 8 import string |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 env=build_environment) | 78 env=build_environment) |
| 79 subprocess.check_call([_MULTI_L10N_PATH, "--cfg", "adblockbrowser-cfg.py"], | 79 subprocess.check_call([_MULTI_L10N_PATH, "--cfg", "adblockbrowser-cfg.py"], |
| 80 env=build_environment) | 80 env=build_environment) |
| 81 | 81 |
| 82 dist_path = os.path.join(_ABB_PATH, obj_dir, "dist") | 82 dist_path = os.path.join(_ABB_PATH, obj_dir, "dist") |
| 83 arch_suffix = _ARCH_X86_I386 if architecture == _ARCH_X86 else _ARCH_ARM | 83 arch_suffix = _ARCH_X86_I386 if architecture == _ARCH_X86 else _ARCH_ARM |
| 84 [manifest_path] = glob.glob(os.path.join( | 84 [manifest_path] = glob.glob(os.path.join( |
| 85 dist_path, "fennec-*.multi.android-%s.json" % arch_suffix)) | 85 dist_path, "fennec-*.multi.android-%s.json" % arch_suffix)) |
| 86 with open(manifest_path) as manifest_file: | 86 with open(manifest_path) as manifest_file: |
| 87 manifest = json.load(manifest_file) | 87 manifest = json.load(manifest_file) |
| 88 | 88 apk_name = "fennec-%s.multi.android-%s-unsigned-unaligned.apk" % ( |
| 89 apk_path = os.path.join(dist_path, "gecko-unsigned-unaligned.apk") | 89 manifest["moz_app_version"], architecture) |
| 90 apk_path = os.path.join(dist_path, apk_name) |
| 90 if build_mode == _BUILD_RELEASE: | 91 if build_mode == _BUILD_RELEASE: |
| 91 target_apk_name = "adblockbrowser-%s-%s.apk" % ( | 92 target_apk_name = "adblockbrowser-%s-%s.apk" % ( |
| 92 manifest["moz_app_version"], architecture) | 93 manifest["moz_app_version"], architecture) |
| 93 else: | 94 else: |
| 94 target_apk_name = "adblockbrowser-%s.%s-%s.apk" % ( | 95 target_apk_name = "adblockbrowser-%s.%s-%s.apk" % ( |
| 95 manifest["moz_app_version"], manifest["buildid"], architecture) | 96 manifest["moz_app_version"], manifest["buildid"], architecture) |
| 96 target_apk_path = os.path.join(dist_path, target_apk_name) | 97 target_apk_path = os.path.join(dist_path, target_apk_name) |
| 97 shutil.copyfile(apk_path, target_apk_path) | 98 shutil.copyfile(apk_path, target_apk_path) |
| 98 | 99 |
| 99 target_manifest_path = re.sub(r".apk$", ".json", target_apk_path) | 100 target_manifest_path = re.sub(r".apk$", ".json", target_apk_path) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 if not do_build and not do_sign: | 133 if not do_build and not do_sign: |
| 133 print_usage() | 134 print_usage() |
| 134 sys.exit(2) | 135 sys.exit(2) |
| 135 | 136 |
| 136 if do_sign: | 137 if do_sign: |
| 137 if len(sys.argv) < 3: | 138 if len(sys.argv) < 3: |
| 138 print_usage() | 139 print_usage() |
| 139 sys.exit(3) | 140 sys.exit(3) |
| 140 apk_path = sys.argv[2] | 141 apk_path = sys.argv[2] |
| 141 | 142 |
| 142 subprocess.check_call([_ENSURE_DEPENDENCIES_PATH]) | 143 # subprocess.check_call([_ENSURE_DEPENDENCIES_PATH]) |
| 143 import config | 144 import config |
| 144 | 145 |
| 145 error_msg = "Invalid %s, check config.py. Supported %s: %s" | 146 error_msg = "Invalid %s, check config.py. Supported %s: %s" |
| 146 distribution_mode = config.DISTRIBUTION_MODE | 147 distribution_mode = config.DISTRIBUTION_MODE |
| 147 if distribution_mode not in _DIST_MODES: | 148 if distribution_mode not in _DIST_MODES: |
| 148 print >>sys.stderr, error_msg % ( | 149 print >>sys.stderr, error_msg % ( |
| 149 "distribution mode", "distribution modes", _DIST_MODES) | 150 "distribution mode", "distribution modes", _DIST_MODES) |
| 150 sys.exit(4) | 151 sys.exit(4) |
| 151 | 152 |
| 152 build_mode = config.BUILD_MODE | 153 build_mode = config.BUILD_MODE |
| 153 if build_mode not in _BUILD_MODES: | 154 if build_mode not in _BUILD_MODES: |
| 154 print >>sys.stderr, error_msg % ( | 155 print >>sys.stderr, error_msg % ( |
| 155 "build mode", "build modes", _BUILD_MODES) | 156 "build mode", "build modes", _BUILD_MODES) |
| 156 sys.exit(5) | 157 sys.exit(5) |
| 157 | 158 |
| 158 architecture = config.ARCHITECTURE | 159 architecture = config.ARCHITECTURE |
| 159 if architecture not in _ARCHS: | 160 if architecture not in _ARCHS: |
| 160 print >>sys.stderr, error_msg % ( | 161 print >>sys.stderr, error_msg % ( |
| 161 "architecture", "architectures", _ARCHS
) | 162 "architecture", "architectures", _ARCHS
) |
| 162 sys.exit(6) | 163 sys.exit(6) |
| 163 | 164 |
| 164 if do_build: | 165 if do_build: |
| 165 apk_path = _build(architecture, distribution_mode, build_mode, | 166 apk_path = _build(architecture, distribution_mode, build_mode, |
| 166 config.ANDROID_SDK_PATH, config.ANDROID_NDK_PATH) | 167 config.ANDROID_SDK_PATH, config.ANDROID_NDK_PATH) |
| 167 if do_sign: | 168 if do_sign: |
| 168 _sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME, | 169 _sign(apk_path, config.ANDROID_KEYSTORE_PATH, config.ANDROID_KEY_NAME, |
| 169 config.ANDROID_SDK_PATH) | 170 config.ANDROID_SDK_PATH) |
| 170 else: | 171 else: |
| 171 print apk_path | 172 print apk_path |
| OLD | NEW |