How to create an Xcode archive without a clean build

We have a fairly large code base that takes a long time to clear the assembly. Whenever we archive an assembly (Product-> Archive), the archiving process first clears everything and then builds.

This seems unnecessary and time-consuming, we would like to be able to create an archive without a clean build. Incremental assemblies must be accurate.

Does anyone know how to disable the β€œclear all” step during the Xcode archiving process? Thank you so much, my searches on this subject came up with only tips on how to make the assembly faster (which is not useful advice for us).

+4
source share
3 answers

Yes it is possible.

As I expected, 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 create an assembly (clean or optional - your choice), then generate .ipa from the assembly. Here is one of the options (the developer identifier and the provisioning profile identifier are deleted, 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 
+5
source

Incremental assemblies are not suitable for Archive. The point is clean - this is because sometimes you can get problems in incremental builds, which are pure fixes. This is an acceptable problem during development, but Archive is designed to build a distribution, and distribution assemblies should not have this risk at all.

Not to mention that your normal build process creates the Debug assembly, and Archive is going to build the Release assembly, so you will have to rebuild most of the application anyway (anything that has changed since the last Release build).

0
source

How to create a continuous integration server so that each commit can initiate a process that leads to an archived assembly. (Hopefully after running tests, etc.), as well as publishing API documents, etc.

It will still take the same amount of time, but since running it in the background after each code check and last release candidate will always be available, you probably won't notice.

Otherwise, you will encounter a headache when you need to do your development in Release mode instead of debugging, etc. - just won't work .

Here is an example project (OSX) that includes a script assembly that a continuous integration server can run. I used Bamboo, but if you need something free, like Jenkins:

https://github.com/jasperblues

In the above project, every successful build (triggered whenever someone executes the code) publishes API documents and test coverage reports to the github page. For the iOS project, you can also archive it.

0
source

All Articles