monorepo/builders/rust.sh

37 lines
643 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)
$CARGO build --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