Update build scripts to run more robustly using xctool

This commit is contained in:
Will Anderson
2015-06-10 16:20:15 -07:00
parent 27448cb28f
commit c72167162e
5 changed files with 59 additions and 6 deletions

45
scripts/build-and-test.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -e
SCRIPTS_PATH=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$1
XCODEPROJ=$2
XCODESCHEME=$3
export REACT_PACKAGER_LOG="$ROOT/server.log"
cd $ROOT
function cleanup {
EXIT_CODE=$?
set +e
sleep 3
$SCRIPTS_PATH/stop-packager.sh
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
#[ -f $REACT_PACKAGER_LOG ] && cat $REACT_PACKAGER_LOG
fi
}
trap cleanup EXIT
#$SCRIPTS_PATH/stop-packager.sh
$SCRIPTS_PATH/start-packager.sh $ROOT
xctool \
-project $XCODEPROJ \
-scheme $XCODESCHEME -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 5,OS=8.3' \
build
xctool \
-project $XCODEPROJ \
-scheme $XCODESCHEME -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 5,OS=8.3' \
test

6
scripts/start-packager.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/sh
$ROOT=$1
command=`node -e "console.log(require('./package').scripts.start)"`
$command &

8
scripts/stop-packager.sh Executable file
View File

@@ -0,0 +1,8 @@
#!/bin/sh
result=`lsof -t -i4TCP:8081`
if [ $result ]
then
kill -9 `lsof -t -i4TCP:8081`
fi