mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-11-24 06:52:44 +03:00
94 lines
1.7 KiB
Bash
Executable File
94 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
BIN=bin
|
|
|
|
function setup_external_tools {
|
|
if [ ! -f "$BIN/test-runner" ]
|
|
then
|
|
mkdir -p "$BIN"
|
|
cabal v2-install --installdir="$BIN" test-lib
|
|
fi
|
|
}
|
|
|
|
function show_usage {
|
|
cat <<EOM
|
|
Usage: $0 COMMAND COMANND_OPTIONS
|
|
Available commands:
|
|
run Run Cryptol
|
|
build Build Cryptol
|
|
haddock Generate Haddock documentation
|
|
test Run some tests
|
|
exe-path Print the location of the local executable
|
|
EOM
|
|
}
|
|
|
|
|
|
|
|
|
|
if [ "$#" == "0" ]
|
|
then
|
|
show_usage
|
|
exit 1
|
|
fi
|
|
|
|
COMMAND=$1
|
|
shift
|
|
|
|
case $COMMAND in
|
|
run)
|
|
cabal exec cryptol -- $*;;
|
|
|
|
build)
|
|
echo Building Cryptol
|
|
|
|
# XXX: This is a workaround the fact that currently Cabal
|
|
# will not rebuild this file, even though it has TH code, that
|
|
# depends on the environment. For now, we temporarily modify the
|
|
# file, then build, then revert it back after build.
|
|
|
|
echo -- Last build $(date) >> src/GitRev.hs
|
|
|
|
cabal v2-build exe:cryptol
|
|
|
|
# WARNING!!!: this is here to undo the HACK date stamp, and will
|
|
# undo any changes to this file, so comment it out if you'd like
|
|
# to change the file
|
|
git checkout src/GitRev.hs
|
|
;;
|
|
|
|
haddock)
|
|
echo Building Haddock documentation
|
|
cabal v2-haddock;;
|
|
|
|
|
|
test)
|
|
echo Running tests
|
|
setup_external_tools
|
|
if [ "$#" == "0" ]
|
|
then TESTS=tests
|
|
else TESTS=$*
|
|
fi
|
|
$BIN/test-runner --ext=.icry \
|
|
--exe=cabal \
|
|
-F v2-run -F -v0 -F exe:cryptol -F -- -F -b \
|
|
$TESTS
|
|
;;
|
|
|
|
help)
|
|
show_usage
|
|
exit 0;;
|
|
|
|
exe-path)
|
|
cabal exec which cryptol
|
|
exit 0;;
|
|
|
|
*)
|
|
echo Unrecognized command: $COMMAND
|
|
show_usage
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
|
|
|