diff --git a/xcodebuild-wrapper.sh b/xcodebuild-wrapper.sh index 28edff5..56141cc 100755 --- a/xcodebuild-wrapper.sh +++ b/xcodebuild-wrapper.sh @@ -12,30 +12,32 @@ IPHONESIM=iphonesim project_file=$1 -echo "Building $project_file..." +echo "Building $project_file..." >&2 commandline="xcodebuild -project $project_file -configuration Debug -sdk iphonesimulator " -echo "The command will be:" -echo "$commandline" +echo "The command will be:" >&2 +echo "$commandline" >&2 buildresult=`$commandline 2>&1` resultcode=$? if [ $resultcode -ne 0 ]; then - echo "Build failed." - echo "Build output:" - echo "$buildresult" + echo "Build failed." >&2 + echo "Build output:" >&2 + echo "$buildresult" >&2 exit fi executable=`echo "$buildresult" | grep Touch | awk ' { print $NF } '` -echo "This produced the executable:" -echo $executable +echo "This produced the executable:" >&2 +echo $executable >&2 # find latest sdk latest=`$IPHONESIM showsdks 2>&1 | grep "(.\..)" | sed "s/.*(\(.\..\))$/\1/" | tail -n 1` -echo "Latest SDK version seems to be $latest." +echo "Latest SDK version seems to be $latest." >&2 $IPHONESIM launch $executable $latest ipad & # Find the directory where this script sits: DIR="$( cd -P "$( dirname "$0" )" && pwd )" # ...and run the applescript. -osascript $DIR/focusSimulator.applescript +# The ugly construction here is so osascript doesn't produce any output. This +# otherwise causes vim to switch to an empty buffer after completion. +echo $( osascript $DIR/focusSimulator.applescript 2>&1 1> /dev/null ) > /dev/null