#!/bin/bash

# This script keeps watch on the current project and compiles it continuously as you change files.
# If there are multiple projects with the same final directory name (e.g., /proj/rad and /lib/monster/rad), 
# this will kill any other similarly-named running projects' binaries, potentially leading to havoc.
 
# To run, execute the following:
# /usr/local/bin/fswatch ./ ./continuous-compile.sh

echo "Re-compiling"

#Count the number of times the compiled app is running
numproc=`ps aux | grep ${PWD##*/}-main.osx | grep -v grep | wc -l`

if [[ numproc > 0 ]]
	then
	killall ${PWD##*/}-main.osx 2> /dev/null
fi

# Build the binary, then
# add in the static components with NRSC, then
# launch the binary in the background
go build -race -o /tmp/${PWD##*/}-main.osx *.go && ./nrsc-script /tmp/${PWD##*/}-main.osx "static templates" -q && /tmp/${PWD##*/}-main.osx &


#!/bin/bash

# This script keeps watch on the current project and compiles it continuously as you change files.
# If there are multiple projects with the same final directory name (e.g., /proj/rad and /lib/monster/rad), 
# this will kill any other similarly-named running projects' binaries, potentially leading to havoc.
 
# To run, execute the following:
# /usr/local/bin/fswatch ./ ./continuous-compile.sh

echo "Re-compiling"

#Count the number of times the compiled app is running
numproc=`ps aux | grep ${PWD##*/}-main.osx | grep -v grep | wc -l`

if [[ numproc > 0 ]]
	then
	killall ${PWD##*/}-main.osx 2> /dev/null
fi

# Build the binary, then
# add in the static components with NRSC, then
# launch the binary in the background
go build -o /tmp/${PWD##*/}-main.osx *.go && ./nrsc-script /tmp/${PWD##*/}-main.osx "static templates" -q && /tmp/${PWD##*/}-main.osx &


Revert "continuous-config.sh now continuously checks for race conditions."
Revert "continuous-config.sh now continuously checks for race conditions."

This reverts commit 06553f50b5d26228ef5095ffa97e87e8b76801b4.

The race condition checker is slow to compile, so it should be done manually
when race conditions need to be checked for.
