from sys import exit from glob import glob import os.path from shutil import rmtree # Don't run in continuous integration or if we're not a build for release if lib.inContinuousIntegration or not lib.isDistributionOrAdHocBuildForDevice: print('Not removing localizations; this is an internal build') exit(0) # The project object has a knownRegions property that is an array of # locale strings (e.g. "Base", "en") that were set up in Xcode. knownRegions = lib.getProjectKeypath('knownRegions') if not knownRegions: lib.warn('The project is reporting that there are no known localizations in your project.\nPlease report this at {}'.format(lib.REPORT_URL)) exit(0) print('Keeping localizations for regions: ' + ', '.join(knownRegions)) regionsAndFoldersToDelete = [] lprojFolders = glob(os.path.join(lib.getEnv('CODESIGNING_FOLDER_PATH'), '*.lproj')) for lprojFolder in lprojFolders: region = lib.bareFilename(lprojFolder) if not region in knownRegions: regionsAndFoldersToDelete.append((region, lprojFolder)) if regionsAndFoldersToDelete: print('Removing extraneous localizations: ' + ', '.join([t[0] for t in regionsAndFoldersToDelete])) try: for _, folder in regionsAndFoldersToDelete:
import os.path from shutil import rmtree # Don't run in continuous integration or if we're not a build for release if lib.inContinuousIntegration or not lib.isDistributionOrAdHocBuildForDevice: print "Not removing localizations; this is an internal build" exit(0) # The project object has a knownRegions property that is an array of # locale strings (e.g. "Base", "en") that were set up in Xcode. knownRegions = lib.getProjectKeypath("knownRegions") if not knownRegions: lib.warn( "The project is reporting that there are no known localizations in your project.\nPlease report this at {}".format( lib.REPORT_URL ) ) exit(0) print "Keeping localizations for regions: " + ", ".join(knownRegions) regionsAndFoldersToDelete = [] lprojFolders = glob(os.path.join(lib.getEnv("CODESIGNING_FOLDER_PATH"), "*.lproj")) for lprojFolder in lprojFolders: region = lib.bareFilename(lprojFolder) if not region in knownRegions: regionsAndFoldersToDelete.append((region, lprojFolder)) if regionsAndFoldersToDelete: print "Removing extraneous localizations: " + ", ".join([t[0] for t in regionsAndFoldersToDelete])
#!/usr/bin/env python2.7 # This script increments the build number (CFBundleVersion in the Info.plist) # on Ad-Hoc or Distribution builds that target real devices. # In the context of Amaro, that means an archive build of any scheme, or any # non-simulator build of the AppStore scheme. # This script should be run as a build phase before the "Copy Bundle Resources" # phase. It has no input or output files. from __future__ import print_function, unicode_literals import AmaroLib as lib from sys import exit # Bail unless we're a build for something that's going to be released if not lib.isDistributionOrAdHocBuildForDevice: print('Not incrementing build number; this is an internal build') exit(0) buildNumber = lib.buildNumber try: buildNumber = int(buildNumber) except ValueError, e: lib.warn('Unable to parse your build number ("{}") as an integer. Not incrementing it!'.format(buildNumber)) exit(0) lib.infoPlist['CFBundleVersionKey'] = str(buildNumber + 1) lib.writePlist(lib.infoPlistFilename, lib.infoPlist, lib.infoPlistFormat)
# This script increments the build number (CFBundleVersion in the Info.plist) # on Ad-Hoc or Distribution builds that target real devices. # In the context of Amaro, that means an archive build of any scheme, or any # non-simulator build of the AppStore scheme. # This script should be run as a build phase before the "Copy Bundle Resources" # phase. It has no input or output files. from __future__ import print_function, unicode_literals import AmaroLib as lib from sys import exit # Bail unless we're a build for something that's going to be released if not lib.isDistributionOrAdHocBuildForDevice: print('Not incrementing build number; this is an internal build') exit(0) buildNumber = lib.buildNumber try: buildNumber = int(buildNumber) except ValueError, e: lib.warn( 'Unable to parse your build number ("{}") as an integer. Not incrementing it!' .format(buildNumber)) exit(0) newBuildNumber = str(buildNumber + 1) lib.infoPlist['CFBundleVersion'] = newBuildNumber print('Incrementing build number to {}'.format(newBuildNumber)) lib.writePlist(lib.infoPlistFilename, lib.infoPlist, lib.infoPlistFormat)