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 bc34b46
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions wrappers/cargo-rel
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/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)
# if there is a user profile provided, do not ever attempt to
# override it
break ;;
--)
# if we got to -- without seeing the command, append --release
# into the last possible position and bail
cargo+=( --profile=release )
break ;;
*)
cargo+=( "$1" )
shift ;;
esac
done

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

0 comments on commit bc34b46

Please sign in to comment.