mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-30 08:12:40 +00:00
52 lines
1.3 KiB
Bash
Executable file
52 lines
1.3 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
builddir="build"
|
|
outdir="out"
|
|
|
|
sdk="iphoneos"
|
|
basecmd="xcodebuild -scheme Vector -workspace Vector.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 "Vector.xcworkspace" ]
|
|
then
|
|
$basecmd clean
|
|
fi
|
|
rm -r "$builddir" "$outdir" || true
|
|
else
|
|
method=$1
|
|
if [ ! -d "Vector.xcworkspace" ]
|
|
then
|
|
echo "Please run pod install first"
|
|
exit 1
|
|
fi
|
|
$basecmd -archivePath "out/Vector.xcarchive" archive GCC_PREPROCESSOR_DEFINITIONS="\$(GCC_PREPROCESSOR_DEFINITIONS) $vars"
|
|
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
|
|
xcodebuild -exportArchive -archivePath "out/Vector.xcarchive" -exportPath out -exportOptionsPlist "$exportOptionsPlist"
|
|
rm "$exportOptionsPlist"
|
|
fi
|