forked from johnno1962/HotReloading
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart_daemon.sh
executable file
·35 lines (26 loc) · 1.14 KB
/
start_daemon.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
#!/bin/bash
#
# Start up daemon process to rebuild changed sources
#
# $Id: //depot/HotReloading/start_daemon.sh#12 $
#
cd "$(dirname $0)"
if [ -f "/tmp/injecting_storyboard.txt" ]; then
rm /tmp/injecting_storyboard.txt
exit 0
fi
DERIVED_LOGS="$(dirname $(dirname $SYMROOT))/Logs/Build"
LAST_LOG=`ls -t $DERIVED_LOGS/*.xcactivitylog | head -n 1`
if [ "$CONFIGURATION" = "Debug" ]; then
export NORMAL_ARCH_FILE="$OBJECT_FILE_DIR_normal/$ARCHS/$PRODUCT_NAME"
export LINK_FILE_LIST="$NORMAL_ARCH_FILE.LinkFileList"
fi
# kill any existing daemon process
kill -9 `ps auxww | grep .build/debug/injectiond | grep -v grep | awk '{ print $2 }'`
# rebuild daemon
/usr/bin/env -i PATH="$PATH" "$TOOLCHAIN_DIR"/usr/bin/swift build &&
# provide a Contents driectory for Cocoa
rm -f .build/debug/Contents && ln -s "$PWD/Contents" .build/debug &&
# run in background passing project file, logs directory
# followed by a list of additional directories to watch.
(.build/debug/injectiond "$PROJECT_FILE_PATH" "$DERIVED_LOGS" `gunzip <$LAST_LOG | tr '\r' '\n' | grep -e ' cd ' | sort -u | grep -v DerivedData | awk '{ print $2 }'` >/tmp/hot_reloading.log 2>&1 &)