This repository has been archived by the owner on Dec 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathbuild.sh
executable file
·75 lines (66 loc) · 1.94 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
#!/bin/bash
#
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
set -eu
function define_xc_macros() {
XC_MACROS="CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
case "$TARGET" in
"lib" ) XC_TARGET="WebDriverAgentLib";;
"runner" ) XC_TARGET="WebDriverAgentRunner";;
*) echo "Unknown TARGET"; exit 1 ;;
esac
case "${DEST:-}" in
"iphone" ) XC_DESTINATION="-destination \"name=iPhone SE,OS=11.2\"";;
"ipad" ) XC_DESTINATION="-destination \"name=iPad Air 2,OS=11.2\"";;
esac
case "$ACTION" in
"build" ) XC_ACTION="build";;
"analyze" )
XC_ACTION="analyze"
XC_MACROS="${XC_MACROS} CLANG_ANALYZER_OUTPUT=plist-html CLANG_ANALYZER_OUTPUT_DIR=\"$(pwd)/clang\""
;;
"unit_test" ) XC_ACTION="test -only-testing:UnitTests";;
"int_test_1" ) XC_ACTION="test -only-testing:IntegrationTests_1";;
"int_test_2" ) XC_ACTION="test -only-testing:IntegrationTests_2";;
"int_test_3" ) XC_ACTION="test -only-testing:IntegrationTests_3";;
*) echo "Unknown ACTION"; exit 1 ;;
esac
case "$SDK" in
"sim" ) XC_SDK="iphonesimulator";;
"device" ) XC_SDK="iphoneos";;
*) echo "Unknown SDK"; exit 1 ;;
esac
}
function analyze() {
xcbuild
if [[ -z $(find clang -name "*.html") ]]; then
echo "Static Analyzer found no issues"
else
echo "Static Analyzer found some issues"
exit 1
fi
}
function xcbuild() {
lines=(
"xcodebuild"
"-project WebDriverAgent.xcodeproj"
"-scheme ${XC_TARGET}"
"-sdk ${XC_SDK}"
"${XC_DESTINATION-}"
"${XC_ACTION}"
"${XC_MACROS}"
)
eval "${lines[*]}" | xcpretty && exit ${PIPESTATUS[0]}
}
./Scripts/bootstrap.sh
define_xc_macros
case "$ACTION" in
"analyze" ) analyze ;;
*) xcbuild ;;
esac