Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: build.py

Issue 29334710: Issue 3590 - Automate release build generation (Closed)
Patch Set: Created Jan. 27, 2016, 1:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # coding: utf-8 2 # coding: utf-8
3 3
4 import os 4 import os
5 import shutil 5 import shutil
6 import subprocess 6 import subprocess
7 import sys
7 import time 8 import time
8 9
9 BASE_DIR = os.path.dirname(os.path.abspath(__file__)) 10 BASE_DIR = os.path.dirname(os.path.abspath(__file__))
10 BUILD_DIR = os.path.join(BASE_DIR, "build") 11 BUILD_DIR = os.path.join(BASE_DIR, "build")
11 BUILD_NUMBER = time.strftime("%Y%m%d%H%M", time.gmtime()) 12 BUILD_NUMBER = time.strftime("%Y%m%d%H%M", time.gmtime())
12 PACKAGE_NAME = "adblockplussafariios-%s.ipa" % BUILD_NUMBER 13 RELEASE_APP_PROVISIONING_PROFILE = "00d92821-2b0f-4036-9b2d-541ce10d0429"
14 RELEASE_EXTENSION_PROVISIONING_PROFILE = "a30dba35-c866-4331-8967-28b9cab60ca2"
15 DEVBUILD_APP_PROVISIONING_PROFILE = "2591efa4-c166-4956-a62a-e3a0cd41f5a3"
16 DEVBUILD_EXTENSION_PROVISIONING_PROFILE = "c4495b74-44a8-499e-ad28-4190912bad0b"
17
18 def print_usage():
19 print >>sys.stderr, "Usage: %s release|devbuild" % \
20 os.path.basename(sys.argv[0])
13 21
14 def build_dependencies(): 22 def build_dependencies():
15 subprocess.check_call(["pod", "install"]) 23 subprocess.check_call(["pod", "install"])
16 subprocess.check_call(["xcodebuild", 24 subprocess.check_call(["xcodebuild",
17 "-workspace", "AdblockPlusSafari.xcworkspace", 25 "-workspace", "AdblockPlusSafari.xcworkspace",
18 "-scheme", "Pods-AdblockPlusSafariExtension", 26 "-scheme", "Pods-AdblockPlusSafariExtension",
19 "CONFIGURATION_BUILD_DIR=" + BUILD_DIR, 27 "CONFIGURATION_BUILD_DIR=" + BUILD_DIR,
20 "build"]) 28 "build"])
21 29
22 def build_apps(): 30 def build_apps(build_type):
31 if build_type == "release":
32 build_configuration = "Release"
33 app_provisioning_profile = RELEASE_APP_PROVISIONING_PROFILE
34 extension_provisioning_profile = RELEASE_EXTENSION_PROVISIONING_PROFILE
35 else:
36 build_configuration = "Devbuild Release"
37 app_provisioning_profile = DEVBUILD_APP_PROVISIONING_PROFILE
38 extension_provisioning_profile = DEVBUILD_EXTENSION_PROVISIONING_PROFILE
39
23 subprocess.check_call(["xcodebuild", 40 subprocess.check_call(["xcodebuild",
24 "-configuration", "Devbuild Release", 41 "-configuration", build_configuration,
25 "CONFIGURATION_BUILD_DIR=" + BUILD_DIR, 42 "CONFIGURATION_BUILD_DIR=" + BUILD_DIR,
26 "BUILD_NUMBER=" + BUILD_NUMBER, 43 "BUILD_NUMBER=" + BUILD_NUMBER,
27 "APP_PROVISIONING_PROFILE=2591efa4-c166-4956-a62a-e3a0c d41f5a3", 44 "APP_PROVISIONING_PROFILE=" + app_provisioning_profile,
28 "EXTENSION_PROVISIONING_PROFILE=c4495b74-44a8-499e-ad28 -4190912bad0b", 45 "EXTENSION_PROVISIONING_PROFILE=" + extension_provision ing_profile,
29 "build"]) 46 "build"])
30 47
31 def package(): 48 def package(build_type):
49 if build_type == "release":
50 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.
51 else:
52 package_name = "adblockplussafariios-devbuild-%s.ipa" % BUILD_NUMBER
53
32 subprocess.check_call(["xcrun", "-sdk", "iphoneos", 54 subprocess.check_call(["xcrun", "-sdk", "iphoneos",
33 "PackageApplication", "-v", 55 "PackageApplication", "-v",
34 os.path.join(BUILD_DIR, "AdblockPlusSafari.app"), 56 os.path.join(BUILD_DIR, "AdblockPlusSafari.app"),
35 "-o", os.path.join(BUILD_DIR, PACKAGE_NAME), 57 "-o", os.path.join(BUILD_DIR, package_name),
36 "-s", "iPhone Distribution: Eyeo GmbH"]) 58 "-s", "iPhone Distribution: Eyeo GmbH"])
37 59
38 if __name__ == "__main__": 60 if __name__ == "__main__":
61 if len(sys.argv) < 2:
62 print_usage()
63 sys.exit(1)
64
65 build_type = sys.argv[1]
66 if build_type not in ["devbuild", "release"]:
67 print_usage()
68 sys.exit(2)
69
39 shutil.rmtree(BUILD_DIR, ignore_errors=True) 70 shutil.rmtree(BUILD_DIR, ignore_errors=True)
40 build_dependencies() 71 build_dependencies()
41 build_apps() 72 build_apps(build_type)
42 package() 73 package(build_type)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld