-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.sh
106 lines (87 loc) · 2.06 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
#!/bin/sh
set -o errexit
set -o errtrace
set -o pipefail
PROJECT="Form.xcodeproj"
SCHEME="Form"
IOS_SDK="iphonesimulator11.3"
IOS_DESTINATION="OS=11.3,name=iPhone X"
usage() {
cat << EOF
Usage: sh $0 command
[Building]
iOS Build iOS framework
examples Build examples
clean Clean up all un-neccesary files
[Testing]
test-iOS Run tests on iOS host
test-native Run tests using `swift test`
[Release]
bump <version> Bumps podspec and xcodeproject to specified version
EOF
}
COMMAND="$1"
case "$COMMAND" in
"clean")
find . -type d -name build -exec rm -r "{}" +\;
exit 0;
;;
"iOS" | "ios")
carthage update Flow --cache-builds
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;
;;
"examples" | "")
pod repo update
for example in examples/*/; do
echo "Building $example."
pod install --project-directory=$example
xcodebuild \
-workspace "${example}Example.xcworkspace" \
-scheme Example \
-sdk "${IOS_SDK}" \
-destination "${IOS_DESTINATION}" \
build
done
exit 0
;;
"test-iOS" | "test-ios")
carthage update Flow --cache-builds
xcodebuild clean \
-project $PROJECT \
-scheme "${SCHEME}" \
-sdk "${IOS_SDK}" \
-destination "${IOS_DESTINATION}" \
-configuration Debug \
ONLY_ACTIVE_ARCH=YES \
CODE_SIGNING_REQUIRED=NO \
ENABLE_TESTABILITY=YES \
build test | xcpretty -c
exit 0;
;;
"test-native")
swift package clean
swift build
swift test
exit 0;
;;
"bump")
VERSION="$2"
if [ -z $VERSION ]
then
echo "Version parameter is not set. \nExample: sh build.sh bump 1.3.0"
exit 0;
fi
fastlane run version_bump_podspec version_number:$VERSION
fastlane run increment_version_number version_number:$VERSION
exit 0;
;;
esac
usage