Skip to content

ci: Cache LLVM builds. #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ matrix:
cache:
directories:
- $HOME/.cargo
- $HOME/.llvm-builds

before_install: . ./ci/before_install.sh

Expand Down
22 changes: 14 additions & 8 deletions ci/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,31 @@ if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
rvm get head || true
fi

function llvm_download() {
function llvm_download_if_needed() {
export LLVM_VERSION_TRIPLE="${LLVM_VERSION}"
export LLVM=clang+llvm-${LLVM_VERSION_TRIPLE}-x86_64-$1

wget http://llvm.org/releases/${LLVM_VERSION_TRIPLE}/${LLVM}.tar.xz
mkdir llvm
tar -xf ${LLVM}.tar.xz -C llvm --strip-components=1
local llvm_build_dir="$HOME/.llvm-builds/${LLVM}"

export LLVM_CONFIG_PATH=`pwd`/llvm/bin/llvm-config
if [ -d "${llvm_build_dir}" ]; then
echo "Using cached LLVM build for ${LLVM} in ${llvm_build_dir}";
else
wget http://llvm.org/releases/${LLVM_VERSION_TRIPLE}/${LLVM}.tar.xz
mkdir -p "${llvm_build_dir}"
tar -xf ${LLVM}.tar.xz -C "${llvm_build_dir}" --strip-components=1
fi

export LLVM_CONFIG_PATH="${llvm_build_dir}/bin/llvm-config"
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
cp llvm/lib/libclang.dylib /usr/local/lib/libclang.dylib
cp "${llvm_build_dir}/lib/libclang.dylib" /usr/local/lib/libclang.dylib
fi
}


if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
llvm_download linux-gnu-ubuntu-14.04
llvm_download_if_needed linux-gnu-ubuntu-14.04
else
llvm_download apple-darwin
llvm_download_if_needed apple-darwin
fi

popd
Expand Down