[caching] `nvm install`: Do not remove src dir after compilation succeeds
This will help speed up the installation time for the non-first time installation, especially can speed up the build time and test time on Travis-CI as we'll cache .cache dir.
parent
fd33179119
commit
03608291a6
12
nvm.sh
12
nvm.sh
|
@ -1871,11 +1871,11 @@ nvm_install_source() {
|
||||||
local TMPDIR
|
local TMPDIR
|
||||||
local VERSION_PATH
|
local VERSION_PATH
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
|
||||||
|
[ -f "${TARBALL}" ] && \
|
||||||
|
TMPDIR="$(dirname "${TARBALL}")/files" && \
|
||||||
if (
|
if (
|
||||||
TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
|
# shellcheck disable=SC2086
|
||||||
[ -f "${TARBALL}" ] && \
|
|
||||||
TMPDIR="$(dirname "${TARBALL}")/files" && \
|
|
||||||
command mkdir -p "${TMPDIR}" && \
|
command mkdir -p "${TMPDIR}" && \
|
||||||
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
|
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
|
||||||
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
|
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
|
||||||
|
@ -1883,8 +1883,7 @@ nvm_install_source() {
|
||||||
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \
|
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \
|
||||||
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} && \
|
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} && \
|
||||||
command rm -f "${VERSION_PATH}" 2>/dev/null && \
|
command rm -f "${VERSION_PATH}" 2>/dev/null && \
|
||||||
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install && \
|
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install
|
||||||
command rm -rf "${TMPDIR}"
|
|
||||||
); then
|
); then
|
||||||
if ! nvm_has "npm" ; then
|
if ! nvm_has "npm" ; then
|
||||||
nvm_echo 'Installing npm...'
|
nvm_echo 'Installing npm...'
|
||||||
|
@ -1904,6 +1903,7 @@ nvm_install_source() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nvm_err "nvm: install ${VERSION} failed!"
|
nvm_err "nvm: install ${VERSION} failed!"
|
||||||
|
command rm -rf "${TMPDIR-}"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue