mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-05-14 23:33:40 +08:00
Update build scripts to run more robustly using xctool
This commit is contained in:
45
scripts/build-and-test.sh
Executable file
45
scripts/build-and-test.sh
Executable 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
6
scripts/start-packager.sh
Executable 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
8
scripts/stop-packager.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
result=`lsof -t -i4TCP:8081`
|
||||
|
||||
if [ $result ]
|
||||
then
|
||||
kill -9 `lsof -t -i4TCP:8081`
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user