Last active
November 14, 2020 03:51
-
-
Save ivan/4cfdb64f96cde53c14be764b34c25e5f to your computer and use it in GitHub Desktop.
Script to update rust nightly and recompile all of your projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu -o pipefail | |
# --force to reinstall in case we updated NixOS and GC'ed old paths, but no new nightly is available | |
rustup update --force | |
rustup default nightly | |
# List most-used projects first so that they're available sooner | |
projects=( | |
~/code/rust/rust-analyzer | |
~/code/rust/something | |
~/code/rust/else | |
) | |
for p in "${projects[@]}"; do | |
echo $p | |
cd "$p" || continue | |
# Remove files older than 2 days from target/ because otherwise it grows | |
# to many GB as target/*/deps has builds for each Rust release | |
find target -type f -mtime +2 -delete || true | |
cargo build --release || true | |
if [[ $p = ~/code/rust/rust-analyzer ]]; then | |
# Custom install procedure for rust-analyzer | |
cp -alf ./target/release/rust-analyzer ~/bin/_rust-analyzer | |
else | |
cargo build || true | |
cargo test || true | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run it nightly on NixOS, use configuration