forked from forcedotcom/SalesforceMobileSDK-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·62 lines (56 loc) · 2.02 KB
/
install.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
#!/bin/bash
# set -x
#
# Run this script before working with the SalesforceMobileSDK Xcode workspace.
#
# Check for iOS SDK minimum version
IOS_MIN_VERSION_NUM=70
IOS_MIN_VERSION_STR="iOS 7.0"
ios_ver=`xcodebuild -version -sdk iphoneos | grep SDKVersion:`
if [[ "$ios_ver" == "" ]]
then
echo "Could not determine iOS SDK version. Is xcodebuild on your path?"
exit 1
fi
ios_ver_num=`echo $ios_ver | sed 's/SDKVersion: \([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1\2/'`
ios_ver_str=`echo $ios_ver | sed 's/SDKVersion: //'`
if [[ $ios_ver_num -lt $IOS_MIN_VERSION_NUM ]]
then
echo "Current configured iOS version ($ios_ver_str) is less than the minimum required version ($IOS_MIN_VERSION_STR)."
exit 2
fi
# Check for Xcode minimum version
XCODE_MIN_VERSION=60
XCODE_MIN_VERSION_STR="Xcode 6.0"
xcode_ver=`xcodebuild -version | grep ^Xcode`
if [[ "$xcode_ver" == "" ]]
then
echo "Could not determine Xcode version. Is xcodebuild on your path?"
exit 3
fi
xcode_ver_num=`echo $xcode_ver | sed 's/^Xcode \([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/\1\2/'`
xcode_ver_str=`echo $xcode_ver | sed 's/^Xcode //'`
if [[ $xcode_ver_num -lt $XCODE_MIN_VERSION ]]
then
echo "Current configured Xcode version ($xcode_ver_str) is less than the minimum required version ($XCODE_MIN_VERSION_STR)."
exit 4
fi
# Sync submodules
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$SCRIPT_DIR"
git submodule init
git submodule sync
git submodule update --init --recursive
# Remove the old Xcode templates, if they still exist.
hybrid_template_dir="${HOME}/Library/Developer/Xcode/Templates/Project Templates/Application/Hybrid Force.com App.xctemplate"
native_template_dir="${HOME}/Library/Developer/Xcode/Templates/Project Templates/Application/Native Force.com REST App.xctemplate"
if [[ -d "${hybrid_template_dir}" ]]
then
echo 'Removing old hybrid template from Xcode.'
rm -rf "${hybrid_template_dir}"
fi
if [[ -d "${native_template_dir}" ]]
then
echo 'Removing old native template from Xcode.'
rm -rf "${native_template_dir}"
fi