-
Notifications
You must be signed in to change notification settings - Fork 15
/
buildipa.sh
executable file
·39 lines (33 loc) · 1.01 KB
/
buildipa.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
#!/bin/sh
set -e
builddir="build"
outdir="out"
sdk="iphoneos"
basecmd="xcodebuild -scheme matrixConsole -workspace matrixConsole.xcworkspace -configuration Release -sdk $sdk -derivedDataPath $builddir"
vars=""
# Clean the Xcode build folder to avoid caching issues that happens sometimes
rm -rf ~/Library/Developer/Xcode/DerivedData/*
if [ -n "$GIT_BRANCH" ]
then
vars="$vars GIT_BRANCH=`echo $GIT_BRANCH | sed -e 's#origin\/##'`"
fi
if [ -n "$BUILD_NUMBER" ]
then
vars="$vars BUILD_NUMBER=$BUILD_NUMBER"
fi
if [ "$1" == 'clean' ]
then
if [ -d "matrixConsole.xcworkspace" ]
then
$basecmd clean
fi
rm -r "$builddir" "$outdir" || true
else
if [ ! -d "matrixConsole.xcworkspace" ]
then
echo "Please run pod install first"
exit 1
fi
$basecmd -archivePath "out/matrixConsole.xcarchive" archive GCC_PREPROCESSOR_DEFINITIONS="\$(GCC_PREPROCESSOR_DEFINITIONS) $vars" "$@"
xcrun -sdk $sdk PackageApplication -v $outdir/matrixConsole.xcarchive/Products/Applications/matrixConsole.app -o `pwd`/out/matrixConsole.ipa
fi