Building-iphone-apps-with-hudson-part-2

Source: Internet
Author: User

I 've already posted before on how to set up Hudson to compile and build iPhone applications, but I just had a "omg I <3 Hudson !" Moment just now, and felt I had to share it.

I do most of my mobile development literally while I'm mobile; on the train during my morning commute, from coffee shops on the weekend, or in front of the TV in the evenings when I'm winding down for the night. because of this, I don't have any consistent time when I'm making checkins, nor do I have the time to create builds for my beta users.

One of the iPhone apps I'm building is for a client, and because my time is limited, I want to streamline communication as much as possible, especially since I have a day job that I really like and uses 8 of my precious 24 hours per day. I don't want to have to tell them every time new features are ready to be tested. additionally, if I have to manually compile and send a beta build to them whenever I complete a new feature, I'll never have enough time to actually get any work done. add to that the fact that your mail servers will block iPhone applications for one reason or another (file size limits, misfiring antivirus filters, or any number of reasons ).

So the solution I 've come up with is an extension of my iPhone application build scripts combined with some nice plugins for Hudson. all of the above steps are completely automatic away and handled for me just by checking my code into git.

  1. The first thing I did was updated my build scripts to generate an ". IPA" archive for distribution builds containing an itunesartwork file, and a release .zip "archive for release builds.
  2. My build script sets the version number of my application to the $ build_number of my Hudson job, so that the version is guaranteed to be unique.
  3. I added the SCP plugin to Hudson and configured a location on my web server where Hudson cocould upload completed builds to the website. This enables my clients to access the page to download new releases.
  4. In order to inform my clients that a new build is available, I 've used thecustomizable email support in Hudson to send an email to a custom list of email addresses when a successful build is completed. in this email I include a link to the uploaded IPA so they can easily download the beta archive.
  5. So that I don't have to go through the trouble of describing what changes I made, I use the $ changes_since_last_success variable in my custom email template that lists all the commit messages I 'd submitted to git that were has ded in this build.
  6. For good measure, I SCP to the website a copy of the ". mobileprovision "certificate file that was used to build the application, so the beta tester can add it to iTunes if the contents have changed.

The result of all this work is that I can work wherever I am, continually committing changes into git. when I'm ready to cut a new build, I submit my changes to GitHub where a webhook script will handle Y Hudson that changes have been made. hudson checks out my changes, builds them on my Mac Mini at home, SCP's the resulting archive up to my web server, and notifies my beta testers that a new archive is available and what changes they shoshould keep an eye out.

For a copy of the build scripts and configuration I use inside my projects, take a look here:

 
Deployments = "Distribution release" provisionrelease = release = 9eb28e74-33f5-4d4249e10-a4c9cc7f5294.mobileprovision
View rawbuild. configthis gist brought to you by GitHub.
 #  ! /Bin/sh  
Function Failed ()
{
Echo " Failed $ *: $ @ " > & 2
Exit 1
}
Set - Ex
Git clean - DFX
Export output = $ Workspace / Output
Rm - RF $ Output
Mkdir - P $ Output
Profile_home = ~ / Library / Mobiledevice / Provisioning \ profiles /
Keychain = ~ / Library / Keychains / Login. keychain
. " $ Workspace/autobuild/build. config "
[ - D " $ Profile_home " ] | Mkdir - P " $ Profile_home "
Security unlock - P'cat ~ / . Build_password'
Agvtool new - Version - All $ Build_number
For Config In $ Deployments ; Do
Provision = $ (Eval echo \ $ 'Echo provision $ Config ')
CERT = " $ Workspace/autobuild/$ provision "
Archive = " $ Output/export job_name-$build_number-appsconfig.zip " ;
Ipaname = " $ Output/$ job_name-$ build_number-$ config. IPA "
Provname = " $ Output/$ job_name-$ build_number-$ config. mobileprovision "
[ -F " $ Cert " ] && CP " $ Cert " " $ Profile_home "
Xcodebuild - Activetarget - Configuration $ Config Build | Failed build;
(
CD build / $ Config - IPhone OS | Failed " No build output " ;
If [ " X $ config " = " Xdistribution " ]; Then
Rm - RF Payload
Rm -F * . IPA
Mkdir Payload
CP - RP * . App Payload /
CP -F $ Workspace / Images / Icon - 512 . PNG Payload / Itunesartwork
Zip - R $ Ipaname Payload
CP $ Cert $ Provname
Else
Zip - R - T - Y " $ Archive " * . App $ Provision | Failed zip;
Fi
)
Done
View rawbuild. shthis gist brought to you by GitHub.

This assumes there's a file in the build user's home directory called ". build_password "that contains the password used to unlock your keychain. run "chmod 600" on that file in order to make it hidden to anyone else on your system. and make sure you check in the ". mobileprovision "files your xcode project file references. if you change your certificates, you'll need to copy the updated mobileprovision files from your "Library/mobiledevice/provisioning profiles" directory.

So you can see why I'm excited about this. I hope you are too.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.