Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create XCode archive without a clean build

We have a fairly large code base that takes a long time to clean build. Whenever we archive the build (Product->Archive) the archive process first cleans all, then builds.

This seems unnecessary and time-consuming, we would like to be able to create an archive without a clean build. Incremental builds should be fine.

Does anybody know how to disable the "clean all" step during the XCode archive process? Thank you so much, my searches on this have come up with nothing but advice on how to make a build faster (which is not useful advice for us).

like image 244
I have no cat Avatar asked Feb 01 '13 06:02

I have no cat


1 Answers

Yes, it is possible.

As I suspected would be the case this can be done from the command-line. It took us a while to figure this out. Here is an excerpt from our TeamCity build scripts. Basically you generate a build (clean or incremental is your choice), then generate and .ipa from the build. Here is one option (developer identity and provision profile ID removed of course):

export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"

xcodebuild -project <PROJECT NAME>.xcodeproj -target <PROJECT NAME> -configuration Release -sdk iphoneos -arch armv7 ONLY_ACTIVE_ARCH=NO CONTRIB_PATH=%system.agent.home.dir%/Contrib2 CODE_SIGN_IDENTITY="iPhone Developer: <DEV NAME> (ID)"  
PROVISIONING_PROFILE=<PROFILE ID>

rm -rf Payload
mkdir Payload

cp -R build/Release-iphoneos/ Payload/

rm ~/<PROJECT NAME>.ipa
xcrun -sdk iphoneos PackageApplication -v Payload/<PROJECT NAME>.app -o ~/<PROJECT NAME>.ipa --sign "iPhone Developer: <DEV NAME> (ID)" --embed ~/Library/MobileDevice/Provisioning\ Profiles/<PROFILE ID>.mobileprovision
like image 123
I have no cat Avatar answered Oct 15 '22 09:10

I have no cat