monorepo/builders/rust.sh

37 lines
641 B
Bash
Raw Normal View History

2023-08-07 18:51:45 +00:00
#!/usr/bin/env bash
2023-08-07 18:51:45 +00:00
set -euo pipefail
if [ ! -z "$MODULE" ]; then
MODULE="-p $MODULE"
fi
2023-08-07 18:51:45 +00:00
if [ -z "${PARAMS-}" ]; then
PARAMS=""
fi
case $CMD in
build)
$CARGO build $MODULE $PARAMS
;;
test)
$CARGO test $MODULE $PARAMS
;;
2023-08-07 20:43:06 +00:00
run)
$CARGO run $MODULE $PARAMS
;;
release)
2023-08-07 20:43:06 +00:00
$CARGO run --release $MODULE $PARAMS
;;
clean)
$CARGO clean $MODULE
;;
"")
2023-08-07 20:43:06 +00:00
echo "No command specified. Use build | test | run | release | clean"
;;
*)
2023-08-07 20:43:06 +00:00
echo "$CMD is unknown. Use build | test | run | release | clean"
;;
esac