unison/scripts/watch2.sh
Arya Irani d2399a46d1 update ./scripts/watch2.sh
continue watching for changes even if initial haskell build fails
2018-08-19 22:52:26 -04:00

28 lines
648 B
Bash
Executable File

#!/usr/bin/env bash
source="$1"
if [ -z "$source" ]; then
echo "usage: $0 <file.u>"
exit 1
fi
assert_command_exists () {
if ! ( type "$1" &> /dev/null ); then
echo "Sorry, I need the '$1' command, but couldn't find it installed." >&2
exit 1
fi
}
assert_command_exists mktemp
assert_command_exists stack
assert_command_exists sbt
assert_command_exists scala
assert_command_exists fswatch
echo "Building parser/typechecker..." && \
stack build && \
echo "Building runtime..." && \
(cd runtime-jvm; sbt main/compile) && \
"`dirname $0`/exec.sh" "$source"
fswatch "$source" . | xargs -n1 "`dirname $0`/exec2.sh" "$source"