This is the script that I use to integrate with Hudson and my iPhone apps.
#!/bin/sh CONFIGURATION="AdHoc" # or Release or Debug # location of files included in dist (.mobileprovision, iTunesArtwork, README) DISTDIR="_distfiles" . build.config MARKETING_VERSION=`agvtool what-marketing-version -terse1` build_xcode () { xcodebuild -configuration "$CONFIGURATION" -sdk $SDK } # CONFIGURATION for xcode build can be overridden from commandline NEWCONFIG="$1" if ! test "$NEWCONFIG"x = x; then echo "=== using configuration from command line $NEWCONFIG" CONFIGURATION="$NEWCONFIG" fi # XCODE check build available for specified configuration CHECKCONFIGURATION=`xcodebuild -list | egrep "$CONFIGURATION($|\ )"` if test "$CHECKCONFIGURATION"x = x; then echo "ERROR: xcodebuild could not find valid build configuration $CONFIGURATION" echo xcodebuild -list echo exit fi VERSION="$MARKETING_VERSION ($BUILD_NUMBER)" ####### echo "=== Building distribution package for $RELEASE - $VERSION" echo "=== setting build number to $BUILD_NUMBER" agvtool new-version -all "${BUILD_NUMBER}" # XCODE make sure buildpath exists for configuration, build if missing BUILDPATH="build/$CONFIGURATION-iphoneos" build_xcode if [ $? != 0 ]; then echo "ERROR: xcodebuild not successful" exit 1 fi if test ! -d "$BUILDPATH"; then echo "ERROR: xcodebuild could not build configuration $CONGIRUATION ($BUILDPATH)" exit fi echo "=== Successfully built configuration $CONFIGURATION ($BUILDPATH)" # HACK : accomodate configurations with spaces, chdir to determine app name cd "$BUILDPATH" # derive name of .app dir (application) APPDIR=`ls -d *.app` cd ../.. APPPATH="$BUILDPATH/$APPDIR" DSYMPATH="$BUILDPATH/$APPDIR.dSYM" if test "$APPDIR"x = x; then APPPATH="$BUILDPATH/.app" fi # XCODE make sure app dir exists in buildpath, build if missing if test ! -d "$APPPATH"; then echo "missing $APPPATH build in $BUILDPATH, trying to build" build_xcode # HACK : accomodate configurations with spaces, chdir to determine app name cd "$BUILDPATH" # derive name of .app dir (application) APPDIR=`ls -d *.app` cd ../.. # check again for APPDIR/APPPATH APPPATH="$BUILDPATH/$APPDIR" if test "$APPDIR"x = x; then APPPATH="$BUILDPATH/.app" fi if test ! -d "$APPPATH"; then echo "ERROR: xcodebuild could not build $APPPATH configuration $CONGIRUATION ($BUILDPATH)" exit fi echo "=== Successfully built $APPDIR configuration $CONFIGURATION ($BUILDPATH)" fi # Create directory for release package echo " - Creating release dir" RELEASEDIR="$RELEASEBASE/$RELEASE-$CONFIGURATION-$MARKETING_VERSION-$BUILD_NUMBER" mkdir -p "$RELEASEDIR" echo "RELEASEDIR = $RELEASEDIR" echo "BUILDPATH = $BUILDPATH" echo "APPPATH = $APPPATH" echo "DSYMPATH = $APPPATH" # Copy other files cp $DISTDIR
Then my hudson configuration looks like this:
./build.sh AdHoc ./build.sh Release
Finally, my archived files look like this:
_release/MobilePracticePro-*-${BUILD_NUMBER}*.zip
Hope this is helpful for you! Hudson's use is really wonderful. Also, make sure your signature key needs to be set in the same field as hudson, and works as the same user. At least that's how it is for me.
source share