Merge pull request #2091 from ewanmellor/travis-cache-dotnet-osx

Add Travis-side caching of the dotnet package that we download from Microsoft
This commit is contained in:
Terence Parr 2017-11-04 10:50:00 -07:00 committed by GitHub
commit 5809f71d0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -5,8 +5,10 @@ language: java
before_cache: before_cache:
- rm -rf $HOME/.m2/repository/org/antlr - rm -rf $HOME/.m2/repository/org/antlr
cache: cache:
timeout: 600
directories: directories:
- $HOME/.m2 - $HOME/.m2
- $HOME/Library/Caches/Antlr4
- $HOME/Library/Caches/Homebrew - $HOME/Library/Caches/Homebrew
stages: stages:

View File

@ -2,6 +2,11 @@
set -euo pipefail set -euo pipefail
cache_dir="$HOME/Library/Caches/Antlr4"
dotnet_url='https://download.microsoft.com/download/B/9/F/B9F1AF57-C14A-4670-9973-CDF47209B5BF/dotnet-dev-osx-x64.1.0.4.pkg'
dotnet_file=$(basename "$dotnet_url")
dotnet_shasum='63b5d99028cd8b2454736076106c96ba7d05f0fc'
thisdir=$(dirname "$0") thisdir=$(dirname "$0")
# OpenSSL setup for dotnet core # OpenSSL setup for dotnet core
@ -10,10 +15,23 @@ ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/
# download dotnet core # download dotnet core
curl https://download.microsoft.com/download/B/9/F/B9F1AF57-C14A-4670-9973-CDF47209B5BF/dotnet-dev-osx-x64.1.0.4.pkg -o /tmp/dotnet-dev-osx-x64.1.0.4.pkg mkdir -p "$cache_dir"
(cd "$cache_dir"
if [ -f "$dotnet_file" ]
then
if ! shasum -s -c <<<"$dotnet_shasum $dotnet_file"
then
rm -f "$dotnet_file"
fi
fi
if ! [ -f "$dotnet_file" ]
then
curl "$dotnet_url" -o "$dotnet_file"
fi
)
# install dotnet core # install dotnet core
sudo installer -pkg /tmp/dotnet-dev-osx-x64.1.0.4.pkg -target / sudo installer -pkg "$cache_dir/$dotnet_file" -target /
# make the link # make the link
ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/ ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/