This repository has been archived by the owner on Jan 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
build.sh
187 lines (161 loc) · 3.88 KB
/
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/bin/sh
set -o errexit
set -o errtrace
set -o pipefail
PROJECT="Overdrive.xcodeproj"
SCHEME="Overdrive"
IOS_SDK="iphonesimulator10.3"
OSX_SDK="macosx10.12"
TVOS_SDK="appletvsimulator10.2"
WATCHOS_SDK="watchsimulator3.1"
IOS_DESTINATION="OS=10.3,name=iPhone 7"
MACOS_DESTINATION="arch=x86_64"
TVOS_DESTINATION="OS=10.2,name=Apple TV 1080p"
WATCHOS_DESTINATION="OS=10.3,name=iPhone SE"
usage() {
cat << EOF
Usage: sh $0 command
[Building]
iOS Build iOS framework
watchOS Build watchOS framework
macOS Build macOS framework
tvOS Build tvOS framework
build Builds all iOS/macOS/tvOS/watchOS targets
clean Clean up all un-neccesary files
[Testing]
test-iOS Run tests on iOS host
test-macOS Run tests on macOS host
test-tvOS Run tests on tvOS target
test-native Run Swift tests without Xcode
test Runs full test suite on all supported hosts
[Docs]
docs Build documentation using jazzy
EOF
}
COMMAND="$1"
case "$COMMAND" in
"clean")
find . -type d -name build -exec rm -r "{}" +\;
exit 0;
;;
"docs")
jazzy \
--author "Swiftable" \
--author_url "swiftable.io" \
--theme fullwidth \
--github_url "https://github.com/arikis/Overdrive" \
--readme "./README.md"
exit 0;
;;
"iOS" | "ios")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${IOS_SDK}" \
-destination "${IOS_DESTINATION}" \
-configuration Debug ONLY_ACTIVE_ARCH=YES \
CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
build | xcpretty -c
exit 0;
;;
"watchOS" | "watchos")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-destination "${IOS_DESTINATION}" \
-configuration Debug ONLY_ACTIVE_ARCH=YES \
build | xcpretty -c
exit 0;
;;
"macOS" | "macos")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${MACOS_SDK}" \
-destination "${MACOS_DESTINATION}" \
-configuration Debug ONLY_ACTIVE_ARCH=YES \
build | xcpretty -c
exit 0;
;;
"tvOS" | "tvos")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${TVOS_SDK}" \
-destination "${TVOS_DESTINATION}" \
-configuration Debug ONLY_ACTIVE_ARCH=YES \
build | xcpretty -c
exit 0;
;;
"build")
sh $0 iOS
sh $0 macOS
sh $0 tvOS
exit 0;
;;
"test-iOS" | "test-ios")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${IOS_SDK}" \
-destination "${IOS_DESTINATION}" \
-configuration Release \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
ENABLE_TESTABILITY=YES \
build test | xcpretty -c
exit 0;
;;
"--test-macOS" | "test-macos")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${MACOS_SDK}" \
-destination "${MACOS_DESTINATION}" \
-configuration Release \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
ENABLE_TESTABILITY=YES \
build test | xcpretty -c
exit 0;
;;
"--test-tvOS" | "test-tvos")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${TVOS_SDK}" \
-destination "${TVOS_DESTINATION}" \
-configuration Release \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
ENABLE_TESTABILITY=YES \
build test | xcpretty -c
exit 0;
;;
"--test-watchOS" | "test-watchos")
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-destination "${WATCHOS_DESTINATION}" \
-configuration Release \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
ENABLE_TESTABILITY=YES \
build test | xcpretty -c
exit 0;
;;
"--test-native" | "test-native")
swift package clean
swift build
swift test
exit 0;
;;
"test")
sh $0 test-iOS
sh $0 test-macOS
sh $0 test-tvOS
sh $0 test-native
exit 0;
;;
esac
usage