Skip to content

Commit

Permalink
Fix new build script
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanj committed Jan 11, 2014
1 parent 159023d commit 79c92e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions GitX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1828,6 +1828,7 @@
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0.12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
Expand All @@ -1848,6 +1849,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
CURRENT_PROJECT_VERSION = 0.12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
Expand Down
20 changes: 12 additions & 8 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
product="%s.app" % (app,)
label="dev"
base_version="0.15"
signing_key="Developer ID Application: Rowan James"

artifact_prefix= "%s-%s" % (app, label)
workspace="%s.xcodeproj/project.xcworkspace" % (app,)
Expand Down Expand Up @@ -41,6 +42,7 @@ def release():

build_config(release_configuration)

build_dir = os.path.join(build_base_dir, release_configuration)
built_product = os.path.join(build_dir, product)
sign_app(built_product)

Expand All @@ -53,7 +55,6 @@ def release():

def debug():
try:
build_dir = os.path.join
build_config(debug_configuration)

except BuildError as e:
Expand All @@ -68,12 +69,12 @@ def build(configuration):
release()

def assert_clean():
status = subprocess.check_output(["git", "status", "--porcelain"])
status = check_string_output(["git", "status", "--porcelain"])
if len(status):
raise BuildError("Working copy must be clean")

def assert_branch(branch="master"):
ref = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip()
ref = check_string_output(["git", "rev-parse", "--abbrev-ref", "HEAD"])
if ref != branch:
raise BuildError("HEAD must be %s, but is %s" % (branch, ref))

Expand All @@ -86,12 +87,12 @@ def clean_config(config):
xcodebuild(app, workspace, config, ["clean"], build_dir)

def commit_count():
count = subprocess.check_output(["git", "rev-list", "HEAD", "--count"])
count = check_string_output(["git", "rev-list", "HEAD", "--count"])
return count

def set_versions(base_version, build_number, label):
print(subprocess.check_output(["agvtool", "mvers", "-terse1"]))
print(subprocess.check_output(["agvtool", "vers", "-terse"]))
print("mvers: " + check_string_output(["agvtool", "mvers", "-terse1"]))
print("vers: " + check_string_output(["agvtool", "vers", "-terse"]))
marketing_version = "%s.%s %s" % (base_version, build_number, label)
build_version = "%s.%s" % (base_version, build_number)
subprocess.check_call(["agvtool", "new-marketing-version", marketing_version])
Expand All @@ -102,13 +103,16 @@ def xcodebuild(scheme, workspace, configuration, commands, build_dir):
cmd = cmd + commands
cmd.append('CONFIGURATION_BUILD_DIR=%s' % (build_dir))
try:
output = subprocess.check_output(cmd)
output = check_string_output(cmd)
return output
except subprocess.CalledProcessError as e:
raise BuildError(str(e))

def check_string_output(command):
return subprocess.check_output(command).decode().strip()

def sign_app(app_path):
sign.sign_everything_in_app(app_path, verbose=2)
sign.sign_everything_in_app(app_path, key=signing_key)

def package_app(app_path, image_path, image_name):
package.package(app_path, image_path, image_name)
Expand Down
4 changes: 2 additions & 2 deletions sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def sign_frameworks_in_app(app_path, key, verbose=0):
for framework in glob.glob(frameworkDir + '/*.framework'):
sign(framework, key, verbose=verbose)

def sign_resources_in_app(app_path, verbose=0):
def sign_resources_in_app(app_path, key, verbose=0):
executableFlags = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
resourcesDir = os.path.join(app_path, 'Contents/Resources')
for filename in os.listdir(resourcesDir):
Expand All @@ -33,7 +33,7 @@ def sign_resources_in_app(app_path, verbose=0):
st = os.stat(filename)
mode = st.st_mode
if mode & executableFlags:
sign(filename)
sign(filename, key, verbose)

def sign_everything_in_app(app_path, key, verbose=0):
sign_frameworks_in_app(app_path, key, verbose=verbose)
Expand Down

0 comments on commit 79c92e5

Please sign in to comment.