-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathios_build.sh
49 lines (39 loc) · 1.58 KB
/
ios_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
#!/bin/bash
set -e
TEAM_ID=$(more ~/Developer/mac_id)
if [ "$1" == "help" ]; then
echo "Run bash ios_build.sh build clean"
echo "Run bash ios_build.sh version"
echo "Go to Xcode Archive Organizer and upload!"
exit
fi
if [ "$1" == "build" ] || [ "$1" == "configure" ]; then
echo "Running CMake configuration..."
# clean up old builds
if [ "$2" == "clean" ]; then rm -Rf build-ios; fi
# generate new builds
cmake -Bbuild-ios -GXcode -DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.4 \
-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM="$TEAM_ID" \
-DCMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY="1,2" \
-DCMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE="NO"
if [ "$1" == "build" ]; then
xcodebuild -project build-ios/ChowCentaur.xcodeproj \
-scheme ChowCentaur_Standalone archive -configuration Release \
-sdk iphoneos -jobs 12 -archivePath ChowCentaur.xcarchive | xcpretty
fi
fi
if [ "$1" == "version" ]; then
# set version number to include commit hash
COMMIT=$(git log --pretty=format:'%h' -n 1)
VERSION=$(cut -f 2 -d '=' <<< "$(grep 'CMAKE_PROJECT_VERSION:STATIC' build-ios/CMakeCache.txt)")
BUILD_NUMBER="$VERSION-$COMMIT"
echo "Setting version for archive: $BUILD_NUMBER"
PLIST=ChowCentaur.xcarchive/Info.plist
/usr/libexec/Plistbuddy -c "Set ApplicationProperties:CFBundleVersion $BUILD_NUMBER" "$PLIST"
# move to archives folder so Xcode can find it
archive_dir="$HOME/Library/Developer/Xcode/Archives/$(date '+%Y-%m-%d')"
echo "Moving to directory: $archive_dir"
mkdir -p "$archive_dir"
mv ChowCentaur.xcarchive "$archive_dir/ChowCentaur-$COMMIT.xcarchive"
fi