Index: build.py |
=================================================================== |
--- a/build.py |
+++ b/build.py |
@@ -4,12 +4,20 @@ |
import os |
import shutil |
import subprocess |
+import sys |
import time |
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
BUILD_DIR = os.path.join(BASE_DIR, "build") |
BUILD_NUMBER = time.strftime("%Y%m%d%H%M", time.gmtime()) |
-PACKAGE_NAME = "adblockplussafariios-%s.ipa" % BUILD_NUMBER |
+RELEASE_APP_PROVISIONING_PROFILE = "00d92821-2b0f-4036-9b2d-541ce10d0429" |
+RELEASE_EXTENSION_PROVISIONING_PROFILE = "a30dba35-c866-4331-8967-28b9cab60ca2" |
+DEVBUILD_APP_PROVISIONING_PROFILE = "2591efa4-c166-4956-a62a-e3a0cd41f5a3" |
+DEVBUILD_EXTENSION_PROVISIONING_PROFILE = "c4495b74-44a8-499e-ad28-4190912bad0b" |
+ |
+def print_usage(): |
+ print >>sys.stderr, "Usage: %s release|devbuild" % \ |
+ os.path.basename(sys.argv[0]) |
def build_dependencies(): |
subprocess.check_call(["pod", "install"]) |
@@ -19,24 +27,47 @@ |
"CONFIGURATION_BUILD_DIR=" + BUILD_DIR, |
"build"]) |
-def build_apps(): |
+def build_apps(build_type): |
+ if build_type == "release": |
+ build_configuration = "Release" |
+ app_provisioning_profile = RELEASE_APP_PROVISIONING_PROFILE |
+ extension_provisioning_profile = RELEASE_EXTENSION_PROVISIONING_PROFILE |
+ else: |
+ build_configuration = "Devbuild Release" |
+ app_provisioning_profile = DEVBUILD_APP_PROVISIONING_PROFILE |
+ extension_provisioning_profile = DEVBUILD_EXTENSION_PROVISIONING_PROFILE |
+ |
subprocess.check_call(["xcodebuild", |
- "-configuration", "Devbuild Release", |
+ "-configuration", build_configuration, |
"CONFIGURATION_BUILD_DIR=" + BUILD_DIR, |
"BUILD_NUMBER=" + BUILD_NUMBER, |
- "APP_PROVISIONING_PROFILE=2591efa4-c166-4956-a62a-e3a0cd41f5a3", |
- "EXTENSION_PROVISIONING_PROFILE=c4495b74-44a8-499e-ad28-4190912bad0b", |
+ "APP_PROVISIONING_PROFILE=" + app_provisioning_profile, |
+ "EXTENSION_PROVISIONING_PROFILE=" + extension_provisioning_profile, |
"build"]) |
-def package(): |
+def package(build_type): |
+ if build_type == "release": |
+ package_name = "adblockplussafariios-release-%s.ipa" % BUILD_NUMBER |
pavel
2016/01/27 14:04:01
Forewarning: Python noob deducting multiparam prin
Felix Dahlke
2016/01/27 16:29:03
No you're quite right, I'll change that.
|
+ else: |
+ package_name = "adblockplussafariios-devbuild-%s.ipa" % BUILD_NUMBER |
+ |
subprocess.check_call(["xcrun", "-sdk", "iphoneos", |
"PackageApplication", "-v", |
os.path.join(BUILD_DIR, "AdblockPlusSafari.app"), |
- "-o", os.path.join(BUILD_DIR, PACKAGE_NAME), |
+ "-o", os.path.join(BUILD_DIR, package_name), |
"-s", "iPhone Distribution: Eyeo GmbH"]) |
if __name__ == "__main__": |
+ if len(sys.argv) < 2: |
+ print_usage() |
+ sys.exit(1) |
+ |
+ build_type = sys.argv[1] |
+ if build_type not in ["devbuild", "release"]: |
+ print_usage() |
+ sys.exit(2) |
+ |
shutil.rmtree(BUILD_DIR, ignore_errors=True) |
build_dependencies() |
- build_apps() |
- package() |
+ build_apps(build_type) |
+ package(build_type) |