forked from libgit2/objective-git
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathxcode_functions.sh
More file actions
executable file
·36 lines (31 loc) · 1016 Bytes
/
xcode_functions.sh
File metadata and controls
executable file
·36 lines (31 loc) · 1016 Bytes
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
#!/bin/bash
# Returns the version # of xcodebuild
# eg. (4.6.3, 5.0, 5.0.1)
function xcode_version ()
{
/usr/bin/xcodebuild -version 2> /dev/null | head -n 1 | awk '{ print $2 }'
}
# Returns the major version of xcodebuild
# eg. (4, 5, 6)
function xcode_major_version ()
{
xcode_version | awk -F '.' '{ print $1 }'
}
# Returns the latest iOS SDK version available via xcodebuild.
function ios_sdk_version ()
{
# The grep command produces output like the following, singling out the
# SDKVersion of just the iPhone* SDKs:
#
# iPhoneOS9.0.sdk - iOS 9.0 (iphoneos9.0)
# SDKVersion: 9.0
# --
# iPhoneSimulator9.0.sdk - Simulator - iOS 9.0 (iphonesimulator9.0)
# SDKVersion: 9.0
/usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }'
}
# Returns the path to the specified iOS SDK name
function ios_sdk_path ()
{
/usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -i $1 | grep 'Path:' | awk '{ print $2 }'
}