Travis: Cache third-party build directory.

Instead of just caching the third-party build output, cache the full
build directory. Always run make to ensure that updated dependencies
are downloaded.
This commit is contained in:
Florian Walch 2015-09-08 12:48:04 +02:00
parent b480eb069b
commit 10cdf8c286
3 changed files with 18 additions and 20 deletions

View File

@ -15,10 +15,8 @@ rm -f "${HOME}/.cache/pip/selfcheck.json"
# Update the third-party dependency cache only if the build was successful.
if [[ -f "${SUCCESS_MARKER}" ]]; then
if [[ ! -f "${CACHE_MARKER}" ]] || [[ "${BUILD_NVIM_DEPS}" == true ]]; then
echo "Updating third-party dependency cache."
rm -rf "${HOME}/.cache/nvim-deps"
mv -T "${DEPS_INSTALL_PREFIX}" "${HOME}/.cache/nvim-deps"
touch "${CACHE_MARKER}"
fi
rm -rf "${HOME}/.cache/nvim-deps"
mv -T "${DEPS_BUILD_DIR}" "${HOME}/.cache/nvim-deps"
touch "${CACHE_MARKER}"
echo "Updated third-party dependencies (timestamp: $(stat -c '%y' "${CACHE_MARKER}"))."
fi

View File

@ -11,19 +11,21 @@ build_deps() {
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_MINGW}"
fi
rm -rf "${DEPS_INSTALL_PREFIX}"
rm -rf "${DEPS_BUILD_DIR}"
# If there is a valid cache and we're not forced to recompile,
# use cached third-party dependencies.
if [[ -f "${CACHE_MARKER}" ]] && [[ "${BUILD_NVIM_DEPS}" != true ]]; then
echo "Using third-party dependencies from Travis's cache (last updated: $(stat -c '%y' "${CACHE_MARKER}"))."
mkdir -p "$(dirname "${DEPS_INSTALL_PREFIX}")"
ln -Ts "${HOME}/.cache/nvim-deps" "${DEPS_INSTALL_PREFIX}"
return
mkdir -p "$(dirname "${DEPS_BUILD_DIR}")"
mv -T "${HOME}/.cache/nvim-deps" "${DEPS_BUILD_DIR}"
else
mkdir -p "${DEPS_BUILD_DIR}"
fi
mkdir -p "${DEPS_BUILD_DIR}"
# Even if we're using cached dependencies, run CMake and make to
# update CMake configuration and update to newer deps versions.
cd "${DEPS_BUILD_DIR}"
echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
cmake ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"

View File

@ -3,9 +3,7 @@ language: c
env:
global:
# To build third-party dependencies, set this to 'true'.
# TODO: Change deps caching to detect updated dependencies automatically, but
# still don't rebuild deps every time.
# To force rebuilding of third-party dependencies, set this to 'true'.
- BUILD_NVIM_DEPS=false
# Travis has 1.5 virtual cores according to
# http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
@ -19,9 +17,9 @@ env:
# Build directory for Neovim.
- BUILD_DIR="$TRAVIS_BUILD_DIR/build"
# Build directory for third-party dependencies.
- DEPS_BUILD_DIR="$TRAVIS_BUILD_DIR/deps-build"
# Directory where compiled third-party dependencies are stored.
- DEPS_INSTALL_PREFIX="$HOME/nvim-deps-install"
- DEPS_BUILD_DIR="$HOME/nvim-deps"
# Directory where third-party dependency sources are downloaded to.
- DEPS_DOWNLOAD_DIR="$TRAVIS_BUILD_DIR/deps-downloads"
# Install directory for Neovim.
- INSTALL_PREFIX="$HOME/nvim-install"
# Log directory for Clang sanitizers and Valgrind.
@ -32,8 +30,8 @@ env:
-DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
-DUSE_GCOV=ON
-DBUSTED_OUTPUT_TYPE=plainTerminal
-DDEPS_PREFIX=$DEPS_INSTALL_PREFIX"
- DEPS_CMAKE_FLAGS="-DDEPS_INSTALL_DIR:PATH=$DEPS_INSTALL_PREFIX"
-DDEPS_PREFIX=$DEPS_BUILD_DIR/usr"
- DEPS_CMAKE_FLAGS="-DDEPS_DOWNLOAD_DIR:PATH=$DEPS_DOWNLOAD_DIR"
# Additional CMake flags for 32-bit builds.
- CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
-DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib