-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·97 lines (94 loc) · 2.3 KB
/
build.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh
if [ "$1" = "" ] ; then
PROFILE=exfe
else
while getopts ":p:" optname; do
case "$optname" in
"p")
PROFILE=$OPTARG
;;
"?")
echo "Unknown option $OPTARG"
echo "Usage: Profile: $0 -p [exfe|0d0f|pilot]"
exit 1
;;
":")
if [ "$OPTARG" = "p" ]; then
PROFILE=exfe
else
echo "No argument value for option $OPTARG"
fi
;;
*)
# Should not occur
echo "Unknown error while processing options"
;;
esac
done
fi
# check param
if [ "$PROFILE" = "" ] ; then
echo "Error: Missing params"
echo "Usage: Profile: $0 -p [exfe|0d0f|pilot|shuady]"
exit 1;
fi
# switch profile
if [ "$PROFILE" = "exfe" ]; then
echo "Switch default profile exfe"
PROJECT="EXFE"
BUILD_ACTION="archive"
SIGN=""
fi
if [ "$PROFILE" = "0d0f" ]; then
echo "Switch profile 0d0f"
PROJECT="0d0f"
BUILD_ACTION="build"
SIGN=""
fi
if [ "$PROFILE" = "pilot" ]; then
echo "Switch profile pilot"
PROJECT="Pilot"
BUILD_ACTION="build"
SIGN=""
fi
if [ "$PROFILE" = "shuady" ]; then
echo "Switch profile shuady"
PROJECT="Shuady"
BUILD_ACTION="build"
SIGN=""
fi
#check value
if [ "$PROJECT" = "" ] ; then
echo "Error: Unknown Profile"
echo "Usage: Profile: $0 -p [exfe|0d0f|pilot|shuady]"
exit 1;
fi
EXFE_VER=m2B
for TEMP in $(expr $(date '+%y') - 10) $(expr $(date '+%m')) $(expr $(date '+%d'))
do
if [ $TEMP -ge 10 ]
then
TEMP=$(printf \\$(printf '%03o' $(expr 55 + $TEMP)))
fi
EXFE_VER=$EXFE_VER$TEMP
done
/usr/libexec/PlistBuddy -c "Set :EXFE-build $EXFE_VER" EXFE/$PROJECT-Info.plist
SCHEME=$PROJECT
PROJECT_FILE="$PROJECT.xcodeproj"
BUILD="xcodebuild"
BUILD_OUTPUT="build.output"
echo Preparing output folder
BUILD_PATH=`pwd`"/builds/"
mkdir -p $BUILD_PATH
echo Removing previous build
IPA_PATH="$BUILD_PATH$PROJECT.ipa"
rm -f $IPA_PATH
echo Cleaning $PROJECT
$BUILD -target $PROJECT -configuration Release -scheme $SCHEME clean > /dev/null
echo $BUILD_ACTION-ing $PROJECT
$BUILD -target $PROJECT -configuration Release -scheme $SCHEME $BUILD_ACTION > $BUILD_OUTPUT
APP_PATH=`cat $BUILD_OUTPUT|grep Validate|awk '{print $2}'`
echo Package $PROJECT
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "$APP_PATH" -o "$IPA_PATH"
echo Cleaning Log $BUILD_OUTPUT
rm -f $BUILD_OUTPUT