Skip to content

Commit

Permalink
chore: use cargo quickinstall for check tools (#13116)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Oct 8, 2023
1 parent 534002d commit c2ce075
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/setup/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,20 @@ function install_cargo_binary {
fi
}

function quickinstall_cargo_binary {
BIN_NAME=$1
VERSION=$2
if cargo install --list | grep "${BIN_NAME}" &>/dev/null; then
echo "${BIN_NAME} is already installed"
else
if [ -z "$VERSION" ]; then
cargo quickinstall "${BIN_NAME}"
else
cargo quickinstall --version "${VERSION}" "${BIN_NAME}"
fi
fi
}

function usage {
cat <<EOF
usage: $0 [options]
Expand Down Expand Up @@ -591,8 +605,9 @@ fi
if [[ "$INSTALL_CHECK_TOOLS" == "true" ]]; then
if [[ -f scripts/setup/rust-tools.txt ]]; then
export RUSTFLAGS="-C target-feature=-crt-static"
install_cargo_binary cargo-quickinstall
while IFS='@' read -r tool version; do
install_cargo_binary "$tool" "$version"
quickinstall_cargo_binary "$tool" "$version"
done <scripts/setup/rust-tools.txt
fi

Expand Down

1 comment on commit c2ce075

@vercel
Copy link

@vercel vercel bot commented on c2ce075 Oct 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.