Wednesday, May 26, 2010

Hudson iPhone builds part 2

The iPhone code we're building against is located in a subversion repository, so to bring it to the Mac build machine we just use Hudson's source code management link to svn within the build.
Once the code has been brought over, here are our build steps:

1. Tag the code in svn. I tried some of the integrated Hudson tools for svn tagging but ended up using a straight svn copy from the shell, like:

cd /users/administrator/Hudson/workspace/
svn copy http://somesvnserver/svn/Code/iPhone http://somesvnserver/svn/Code/tags/$BUILD_TAG -m "Create -iPhone tag - trunk" --username blah --password blah

2. For the simulator builds we jump right to the build step. But for device builds there's a need to do a valid code signing, and that means unlocking the keychain from the command line. So for device builds our second step looks like this:

cd /Library/Keychains
security unlock -p password login.keychain
cd /users/administrator/Hudson/workspace/
xcodebuild clean -alltargets -configuration Release build SDKROOT=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk TARGETED_DEVICE_FAMILY=iPhone

3. For internal builds we copy in the provisioning file with each build:

cp "/users/administrator/Hudson/workspace/Certs and Profiles/iphone.provision" /users/administrator/Hudson/workspace/release-iphoneos

4. The next step removes the dSYM directory from the build. There's a way to do this from the xcode build call itself, just doing this temporarily to remove those folders:

cd /users/administrator/Hudson/workspace/Release-iphoneos
rm -r iphone.app.dSYM/Contents/Resources/DWARF
rm -r iphone.app.dSYM/Contents/Resources
rm -r iphone.app.dSYM/Contents
rm -r iphone.app.dSYM

5. Then a step to zip up the contents of the folder so it can be delivered:

cd /users/administrator/Hudson/workspace/build
ditto -c -k --sequesterRsrc --keepParent release-iphoneos $BUILD_TAG.zip

Next post, how the zip is delivered

1 comment: