Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 44 lines (37 sloc) 1.2 KB
#!/bin/bash
stack update
CMD="stack build hie-bios hie-core haskell-lsp --copy-compiler-tool"
$CMD
STATUS=$?
if [[ $STATUS -eq 0 ]]; then
exit 0
fi
printf -v missingDeps "extra-deps:\n%s" "$($CMD 2>&1 | rg '^-')"
echo ""
echo "====================================================="
echo ""
echo "Attempting to add extra-deps to stack.yaml"
if which yq > /dev/null 2>&1 ; then
echo "====================================================="
echo "Would you like me to add the following extra-deps?"
echo "====================================================="
echo "$missingDeps"
echo "====================================================="
echo "Note that it'll re-write your stack.yaml and remove any comments :'("
echo "y/n"
read -r RESP
if [[ $RESP =~ ^[yY]$ ]]; then
yq m -i -a ./stack.yaml <(echo "$missingDeps")
echo "Added deps, trying again (you may need to re-run this script multiple times until it succeeds)"
$CMD
else
exit 1
fi
else
echo "yq not found on path" >&2
echo "You can install it with:" >&2
echo " brew install yq" >&2
echo "OR" >&2
echo " sudo apt install yq -y" >&2
exit 1
fi
You can’t perform that action at this time.