-
Notifications
You must be signed in to change notification settings - Fork 586
/
build.sh
executable file
·93 lines (77 loc) · 2.24 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
#!/bin/sh
# Go to root directory of the script
pushd $(dirname $0)
if [ -z $1 ]; then
echo "usage: build.sh <subcommand>"
echo "available subcommands:"
echo " ci-componentkit-ios"
echo " ci-componentkit-tvos"
echo " ci-wildeguess-ios"
echo " docs"
exit
fi
set -eu
MODE=$1
function project_version() {
# get contents -> grep for project version line -> cut string with '=' delimeter, take 2nd value -> trim whitespaces.
more ComponentKit/ComponentKit.xcconfig | grep "CURRENT_PROJECT_VERSION = [\.0-9]*" | cut -d = -f 2 | xargs echo -n
}
function ci() {
# replace line contains s.version with a new line contains value of `project_version`.
sed -i -e "s/s.version = \'[\.0-9]*\'/s.version = \'$(project_version)\'/g" ComponentKit.podspec
xcodebuild \
clean \
-project $1 \
-scheme $2 \
-sdk $3 \
-destination "$4" \
-configuration $5 \
$6 \
-json \
-UseModernBuildSystem=NO
}
function ios_ci() {
ci $1 $2 iphonesimulator "platform=iOS Simulator,name=iPhone 8" Release $3
}
function tvos_ci() {
ci $1 $2 appletvsimulator "platform=tvOS Simulator,name=Apple TV" Release $3
}
function carthage_bootstrap() {
carthage bootstrap --platform iOS --no-use-binaries || true
}
carthage_bootstrap
if [ "$MODE" = "ci-componentkit-ios" ]; then
ios_ci ComponentKit.xcodeproj ComponentKit test
fi
if [ "$MODE" = "ci-componentkit-tvos" ]; then
tvos_ci ComponentKit.xcodeproj ComponentKitAppleTV test
fi
if [ "$MODE" = "ci-wildeguess-ios" ]; then
ios_ci Examples/WildeGuess/WildeGuess.xcodeproj WildeGuess build
fi
if [ "$MODE" = "docs" ]; then
HEADERS=`ls ComponentKit/**/*.h ComponentTextKit/**/*.h`
rm -rf appledoc
appledoc \
--no-create-docset \
--create-html \
--exit-threshold 2 \
--no-repeat-first-par \
--no-merge-categories \
--explicit-crossref \
--warn-missing-output-path \
--warn-missing-company-id \
--warn-undocumented-object \
--warn-undocumented-member \
--warn-empty-description \
--warn-unknown-directive \
--warn-invalid-crossref \
--warn-missing-arg \
--project-name ComponentKit \
--project-company Facebook \
--company-id "org.componentkit" \
--output appledoc \
$HEADERS
fi
# Go back to the initial directory
popd