2015-04-22 23:04:06 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-06-15 15:52:58 +00:00
|
|
|
set -ex
|
2015-04-22 23:04:06 +00:00
|
|
|
|
|
|
|
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
ROOT=$(dirname $SCRIPTS)
|
|
|
|
|
|
|
|
cd $ROOT
|
|
|
|
|
|
|
|
function cleanup {
|
|
|
|
EXIT_CODE=$?
|
|
|
|
set +e
|
|
|
|
|
|
|
|
if [ $EXIT_CODE -ne 0 ];
|
|
|
|
then
|
|
|
|
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
|
|
|
|
[ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS
|
|
|
|
fi
|
2016-07-08 10:23:41 +00:00
|
|
|
# kill whatever is occupying port 8081
|
|
|
|
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
2015-04-22 23:04:06 +00:00
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
2016-06-15 15:52:58 +00:00
|
|
|
XCODE_PROJECT="Examples/UIExplorer/UIExplorer.xcodeproj"
|
|
|
|
XCODE_SCHEME="UIExplorer"
|
|
|
|
XCODE_SDK="iphonesimulator"
|
2016-06-08 11:41:15 +00:00
|
|
|
if [ -z "$XCODE_DESTINATION" ]; then
|
2016-07-15 15:43:56 +00:00
|
|
|
XCODE_DESTINATION="platform=iOS Simulator,name=iPhone 5s,OS=9.3"
|
2016-06-08 11:41:15 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Support for environments without xcpretty installed
|
|
|
|
set +e
|
|
|
|
OUTPUT_TOOL=$(which xcpretty)
|
|
|
|
set -e
|
|
|
|
|
2016-04-23 06:03:12 +00:00
|
|
|
# TODO: We use xcodebuild because xctool would stall when collecting info about
|
|
|
|
# the tests before running them. Switch back when this issue with xctool has
|
|
|
|
# been resolved.
|
2016-06-15 15:52:58 +00:00
|
|
|
if [ -z "$OUTPUT_TOOL" ]; then
|
|
|
|
xcodebuild \
|
|
|
|
-project $XCODE_PROJECT \
|
|
|
|
-scheme $XCODE_SCHEME \
|
|
|
|
-sdk $XCODE_SDK \
|
|
|
|
-destination "$XCODE_DESTINATION" \
|
|
|
|
test
|
|
|
|
else
|
|
|
|
xcodebuild \
|
|
|
|
-project $XCODE_PROJECT \
|
|
|
|
-scheme $XCODE_SCHEME \
|
|
|
|
-sdk $XCODE_SDK \
|
|
|
|
-destination "$XCODE_DESTINATION" \
|
|
|
|
test | $OUTPUT_TOOL && exit ${PIPESTATUS[0]}
|
|
|
|
fi
|
2016-10-05 14:15:25 +00:00
|
|
|
|