Skip to content

Instantly share code, notes, and snippets.

@vincentisambart
Last active August 29, 2015 14:19
Show Gist options
  • Save vincentisambart/568a5496a13ea8bfa6e5 to your computer and use it in GitHub Desktop.
Save vincentisambart/568a5496a13ea8bfa6e5 to your computer and use it in GitHub Desktop.
# Warning: BUILD_DIRECTORY must be an absolute path for this script to work properly
rm -rf $BUILD_DIRECTORY
ARCHIVE_PATH=$BUILD_DIRECTORY/$TARGET.xcarchive
IPA_PATH=$BUILD_DIRECTORY/$TARGET.ipa
xcodebuild -workspace $WORKSPACE -scheme $SCHEME -derivedDataPath $BUILD_DIRECTORY -archivePath $ARCHIVE_PATH archive
# As xcodebuild -exportArchive doesn't seem to work properly with WatchKit apps, I ended up making the IPA file by hand.
# https://devforums.apple.com/message/1120211#1120211 has some information about doing that.
DIRECTORY_FOR_ARCHIVING=$BUILD_DIRECTORY/archiving
mkdir -p $DIRECTORY_FOR_ARCHIVING
cd $DIRECTORY_FOR_ARCHIVING
# we are creating symbolic links, but in the zip (ipa) they will be stored as normal directories (and that's what we want)
ln -s $ARCHIVE_PATH/Products/Applications Payload
WATCHKIT_SOURCE=$ARCHIVE_PATH/WatchKitSupport
if [ -e "$WATCHKIT_SOURCE" ]; then
ln -s $WATCHKIT_SOURCE WatchKitSupport
fi
zip -r $IPA_PATH .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment