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

Unified Diff: build.py

Issue 29334710: Issue 3590 - Automate release build generation (Closed)
Patch Set: Address issues Created Jan. 28, 2016, 5:21 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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"])
@@ -17,26 +25,51 @@
"-workspace", "AdblockPlusSafari.xcworkspace",
"-scheme", "Pods-AdblockPlusSafariExtension",
"CONFIGURATION_BUILD_DIR=" + BUILD_DIR,
- "build"])
+ "archive"])
-def build_apps():
+def build_app(build_type, build_name):
+ 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
+ archive_path = os.path.join(BUILD_DIR, build_name + ".xcarchive")
subprocess.check_call(["xcodebuild",
- "-configuration", "Devbuild Release",
+ "-configuration", build_configuration,
+ "-scheme", "AdblockPlusSafari",
"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",
- "build"])
+ "APP_PROVISIONING_PROFILE=" + app_provisioning_profile,
+ "EXTENSION_PROVISIONING_PROFILE=" + extension_provisioning_profile,
+ "ENABLE_BITCODE=NO",
Felix Dahlke 2016/01/28 17:25:55 I couldn't make `-exportArchive` work without doin
+ "archive",
+ "-archivePath", archive_path])
+ return archive_path
-def package():
- subprocess.check_call(["xcrun", "-sdk", "iphoneos",
- "PackageApplication", "-v",
- os.path.join(BUILD_DIR, "AdblockPlusSafari.app"),
- "-o", os.path.join(BUILD_DIR, PACKAGE_NAME),
- "-s", "iPhone Distribution: Eyeo GmbH"])
+def package_app(archive_path, build_type, build_name):
+ subprocess.check_call(["xcodebuild",
+ "-exportArchive",
+ "-archivePath", archive_path,
+ "-exportPath", BUILD_DIR,
+ "-exportOptionsPlist", build_type + "ExportOptions.plist"])
pavel 2016/02/01 10:18:15 Oh wow. Seeing that -exportOptionsPlist doc was wo
+ os.rename(os.path.join(BUILD_DIR, "AdblockPlusSafari.ipa"),
+ os.path.join(BUILD_DIR, build_name + ".ipa"))
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_name = "adblockplussafariios-%s-%s" % (build_type, BUILD_NUMBER)
+ archive_path = build_app(build_type, build_name)
+ package_app(archive_path, build_type, build_name)

Powered by Google App Engine
This is Rietveld