2015-01-29 15:15:02 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
builddir="build"
|
|
|
|
outdir="out"
|
|
|
|
|
|
|
|
sdk="iphoneos"
|
2017-03-08 09:24:21 +00:00
|
|
|
basecmd="xcodebuild -scheme Riot -workspace Riot.xcworkspace -configuration Release -sdk $sdk -derivedDataPath $builddir"
|
2015-02-04 17:42:17 +00:00
|
|
|
vars=""
|
|
|
|
|
2016-08-16 14:45:24 +00:00
|
|
|
# Clean the Xcode build folder to avoid caching issues that happens sometimes
|
|
|
|
rm -rf ~/Library/Developer/Xcode/DerivedData/*
|
|
|
|
|
2015-02-04 17:42:17 +00:00
|
|
|
if [ -n "$GIT_BRANCH" ]
|
|
|
|
then
|
2015-02-04 18:35:56 +00:00
|
|
|
vars="$vars GIT_BRANCH=`echo $GIT_BRANCH | sed -e 's#origin\/##'`"
|
2015-02-04 17:42:17 +00:00
|
|
|
fi
|
|
|
|
if [ -n "$BUILD_NUMBER" ]
|
|
|
|
then
|
|
|
|
vars="$vars BUILD_NUMBER=$BUILD_NUMBER"
|
|
|
|
fi
|
2015-01-29 15:15:02 +00:00
|
|
|
|
2015-02-26 11:30:35 +00:00
|
|
|
if [ "$1" == 'clean' ]
|
2015-01-29 15:15:02 +00:00
|
|
|
then
|
2017-03-08 09:24:21 +00:00
|
|
|
if [ -d "Riot.xcworkspace" ]
|
2015-04-07 10:14:47 +00:00
|
|
|
then
|
|
|
|
$basecmd clean
|
|
|
|
fi
|
2015-01-29 15:15:02 +00:00
|
|
|
rm -r "$builddir" "$outdir" || true
|
2015-02-26 11:30:35 +00:00
|
|
|
else
|
2017-01-10 11:58:43 +00:00
|
|
|
method=$1
|
2017-03-08 09:24:21 +00:00
|
|
|
if [ ! -d "Riot.xcworkspace" ]
|
2015-04-07 10:07:48 +00:00
|
|
|
then
|
|
|
|
echo "Please run pod install first"
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-03-08 09:24:21 +00:00
|
|
|
$basecmd -archivePath "out/Riot.xcarchive" archive GCC_PREPROCESSOR_DEFINITIONS="\$(GCC_PREPROCESSOR_DEFINITIONS) $vars"
|
2017-01-10 11:58:43 +00:00
|
|
|
exportOptionsPlist=`mktemp`
|
|
|
|
cat > $exportOptionsPlist <<EOD
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
|
|
<plist version="1.0">
|
|
|
|
<dict>
|
|
|
|
<key>method</key>
|
|
|
|
<string>$method</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOD
|
2017-09-29 21:15:41 +00:00
|
|
|
xcodebuild -exportArchive -archivePath "out/Riot.xcarchive" -exportPath out -exportOptionsPlist "$exportOptionsPlist"
|
2017-01-10 11:58:43 +00:00
|
|
|
rm "$exportOptionsPlist"
|
2015-01-29 15:15:02 +00:00
|
|
|
fi
|