Skip to content

Commit

Permalink
wrappers: cargo-rel: workaround for rust-lang/cargo#10271 and co.
Browse files Browse the repository at this point in the history
Wrapper for `cargo --profile=release` with a custom config, to make up
for absence of per-profile options (flags, env) in (stable) Cargo.
  • Loading branch information
intelfx committed Apr 3, 2024
1 parent 7816a6a commit 2f5cbef
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions wrappers/cargo-rel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

cargo=(
cargo
--config "$HOME/.cargo/config-rel.toml"
)

while (( $# )); do
case "$1" in
run|build|check|rustc|install)
cargo+=( "$1" --profile=release )
shift
break ;;
--profile*|--release|--dev)
cargo+=( "$1" )
shift
break ;;
--)
# if we got to -- without seeing the command, append --release
# into the last possible position and bail
cargo+=( --profile=release "$1" )
shift
break ;;
*)
cargo+=( "$1" )
shift ;;
esac
done

set -x
exec "${cargo[@]}" "$@"

0 comments on commit 2f5cbef

Please sign in to comment.