Skip to content

Commit 35bf7d6

Browse files
committed
Clean up cache after new rustc version
Copied from crates.io repo
1 parent f5bda03 commit 35bf7d6

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ rust:
99
- nightly
1010

1111
before_install:
12+
- script/ci/cargo-clean-on-new-rustc-version.sh
1213
- rustup component add rustfmt
1314
- rustup component add clippy
1415

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
stamp_file=target/rustc_version_stamp
6+
current_version=$(rustc --version)
7+
8+
if [ -f $stamp_file ]; then
9+
# Compare the current version against the previous version
10+
if echo "$current_version" | cmp -s $stamp_file -; then
11+
echo "Version of rustc hasn't changed, keeping the cache intact"
12+
else
13+
echo "The version of rustc has changed, running cargo clean"
14+
cargo clean
15+
fi
16+
else
17+
echo "There is no existing version stamp, keeping the cache intact"
18+
fi
19+
20+
# Save the version stamp for next time
21+
mkdir -p target/
22+
echo $current_version > $stamp_file

0 commit comments

Comments
 (0)