forked from huhuvipi/VH_ipa_packger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage_ipa.sh
executable file
·32 lines (27 loc) · 904 Bytes
/
package_ipa.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
IPA="$1"
TEMP_IPA_BUILT="/tmp/ipabuild"
DEVELOPER_DIR=`xcode-select --print-path`
APP="${TEMP_IPA_BUILT}/Payload/*.app"
if [ ! -d "${DEVELOPER_DIR}" ]; then
echo "No developer directory found!"
exit 1
fi
#reparing for temp directory
if [ -d "${TEMP_IPA_BUILT}" ];
then
rm -rf "${TEMP_IPA_BUILT}"
fi
mkdir ${TEMP_IPA_BUILT}
echo "unzip the ipa"
unzip -q "${IPA}.ipa" -d "${TEMP_IPA_BUILT}"
echo "+ Adding SWIFT support (if necessary)"
mkdir -p "${TEMP_IPA_BUILT}/SwiftSupport"
for SWIFT_LIB in $(ls -1 ${APP}/Frameworks); do
echo "Copying ${SWIFT_LIB}"
cp "${DEVELOPER_DIR}/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/${SWIFT_LIB}" "${TEMP_IPA_BUILT}/SwiftSupport"
done
rm -rf "${IPA}"
echo "+ zip --symlinks --verbose --recurse-paths ${IPA} ."
cd "${TEMP_IPA_BUILT}"
zip --symlinks --verbose --recurse-paths "${IPA}.ipa" .
echo "===ADDING SWIFT_LIB SUCCESS==="