diff --git a/.travis.yml b/.travis.yml index 3f7c856a7f76..b20eda61928c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,10 @@ os: - osx - windows +cache: + directories: + - $HOME/.cargo/bin/rustup-toolchain-install-master + branches: # Don't build these branches except: diff --git a/setup-toolchain.sh b/setup-toolchain.sh index c1c8366bf5e7..580c00a37605 100755 --- a/setup-toolchain.sh +++ b/setup-toolchain.sh @@ -3,8 +3,15 @@ cd "$(dirname "$0")" +cratesio_version=$(cargo search rustup-toolchain-install-master | grep -o "[0-9]\.[0-9]\.[0-9]") +rtim_version=$(rustup-toolchain-install-master --version | grep -o "[0-9]\.[0-9]\.[0-9]") + if ! command -v rustup-toolchain-install-master > /dev/null; then cargo install rustup-toolchain-install-master --debug +else + if [ $rtim_version != $cratesio_version ]; then + cargo install rustup-toolchain-install-master --debug --force + fi fi RUSTC_HASH=$(git ls-remote https://github.com/rust-lang/rust.git master | awk '{print $1}')