Created
May 11, 2015 16:53
-
-
Save phatblat/6eb8895e2202f796960e to your computer and use it in GitHub Desktop.
A quick script to package up an .ipa correctly since `xcodebuild -exportArchive` misses the required SwiftSupport and WatchKitSupport folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# | |
# package-ipa.sh | |
# | |
# Bundles an iOS app correctly, using the same directory structure that Xcode does when using the export functionality. | |
# | |
xcarchive="$1" | |
output_ipa="$2" | |
build_dir=$(mktemp -d '/tmp/package-ipa.XXXXXX') | |
echo "build_dir: $build_dir" | |
if [ ! -d "${xcarchive}" ]; then | |
echo "Usage: package-ipa.sh /path/to/app.xcarchive /path/to/ouput.ipa" | |
exit 1 | |
fi | |
echo "Packaging ${xcarchive} into ${output_ipa}" | |
if [ -f "${output_ipa}" ]; then | |
rm "${output_ipa}" | |
fi | |
# if [ -d "${build_dir}" ]; then | |
# rm -rf "${build_dir}" | |
# fi | |
echo "Preparing folder tree for IPA" | |
mkdir -p "${build_dir}/Payload" | |
# Copy .app into Payload dir | |
pushd "${xcarchive}/Products/Applications" > /dev/null | |
ls -l | |
cp -Rp ./*.app "${build_dir}/Payload" | |
popd > /dev/null | |
# Check for and copy swift libraries | |
if [ -d "${xcarchive}/SwiftSupport" ]; then | |
echo "Adding Swift support dylibs" | |
cp -Rp "${xcarchive}/SwiftSupport" "${build_dir}/" | |
fi | |
# Check for and copy WatchKit file | |
if [ -d "${xcarchive}/WatchKitSupport" ]; then | |
echo "Adding WatchKit support file" | |
cp -Rp "${xcarchive}/WatchKitSupport" "${build_dir}/" | |
fi | |
echo "Zipping" | |
pushd "${build_dir}" > /dev/null | |
zip --symlinks --verbose --recurse-paths "${output_ipa}" . | |
popd > /dev/null | |
rm -rf "${build_dir}" | |
echo "Created ${output_ipa}" |
Nice script, works great !!
It doesn't include the Symbols folder, is this folder required ?
thanks
Frank
There's actually a new flag to use when you're creating your IPA from an XCArchive. That way you won't have to have a custom script.
http://encyclopediaofdaniel.com/blog/xcarchive-to-ipa/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://openradar.appspot.com/20898925
New .ipa layout confirmed in dev forums: https://devforums.apple.com/message/1120270#1120211