-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathipabuild.sh
More file actions
executable file
·78 lines (62 loc) · 1.97 KB
/
ipabuild.sh
File metadata and controls
executable file
·78 lines (62 loc) · 1.97 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
set -e
cd "$(dirname "$0")"
WORKING_LOCATION="$(pwd)"
APPLICATION_NAME="Luna"
PLATFORM=${1:-ios}
case "$PLATFORM" in
ios|iOS)
PLATFORM="ios"
SDK="iphoneos"
XCODE_DESTINATION="generic/platform=iOS"
PLATFORM_DIR="Release-iphoneos"
OUTPUT_SUFFIX=""
;;
tvos|tvOS)
PLATFORM="tvos"
SDK="appletvos"
XCODE_DESTINATION="generic/platform=tvOS"
PLATFORM_DIR="Release-appletvos"
OUTPUT_SUFFIX="-tvOS"
;;
*)
echo "Error: Invalid platform '$PLATFORM'"
echo "Usage: $0 [ios|tvos]"
echo " ios - Build for iOS (default)"
echo " tvos - Build for tvOS"
exit 1
;;
esac
if [ ! -d "build" ]; then
mkdir build
fi
cd build
if [ -d "DerivedData$PLATFORM" ]; then
rm -rf "DerivedData$PLATFORM"
fi
xcodebuild -project "$WORKING_LOCATION/$APPLICATION_NAME.xcodeproj" \
-scheme "$APPLICATION_NAME" \
-configuration Release \
-derivedDataPath "$WORKING_LOCATION/build/DerivedData$PLATFORM" \
-destination "$XCODE_DESTINATION" \
-sdk "$SDK" \
clean build \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
DD_APP_PATH="$WORKING_LOCATION/build/DerivedData$PLATFORM/Build/Products/$PLATFORM_DIR/$APPLICATION_NAME.app"
TARGET_APP="$WORKING_LOCATION/build/$APPLICATION_NAME$OUTPUT_SUFFIX.app"
cp -r "$DD_APP_PATH" "$TARGET_APP"
codesign --remove "$TARGET_APP" 2>/dev/null || true
if [ -e "$TARGET_APP/_CodeSignature" ]; then
rm -rf "$TARGET_APP/_CodeSignature"
fi
if [ -e "$TARGET_APP/embedded.mobileprovision" ]; then
rm -rf "$TARGET_APP/embedded.mobileprovision"
fi
mkdir Payload
cp -r "$TARGET_APP" "Payload/$APPLICATION_NAME.app"
if [ -f "Payload/$APPLICATION_NAME.app/$APPLICATION_NAME" ]; then
strip "Payload/$APPLICATION_NAME.app/$APPLICATION_NAME" 2>/dev/null || true
fi
zip -qr "$APPLICATION_NAME$OUTPUT_SUFFIX.ipa" Payload
rm -rf "$TARGET_APP"
rm -rf Payload