diff --git a/Dockerfile b/Dockerfile index 12990cd5..9cc78fb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -485,6 +485,14 @@ RUN brew tap homebrew/bundle WORKDIR / +################################################################################ +# +# rustup +# +################################################################################ +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none +ENV PATH "$PATH:/opt/buildhome/.cargo/bin" + # Cleanup USER root diff --git a/included_software.md b/included_software.md index ffe1e0d0..e98beb71 100644 --- a/included_software.md +++ b/included_software.md @@ -36,6 +36,9 @@ The specific patch versions included will depend on when the image was last buil * Not installed by default. * Supports any version that `swiftenv` can install later than `4.x`. Versions `4.x` and earlier will not work due to incompatible shared libraries. * 5.2 is installed if `Package.swift` is present and no version is specified with `SWIFT_VERSION` or `.swift-version`. +* Rust + * Not installed by default. + * Supports any version that `rustup` can install. ### Tools diff --git a/run-build-functions.sh b/run-build-functions.sh index b9df48f8..6d17bacb 100755 --- a/run-build-functions.sh +++ b/run-build-functions.sh @@ -57,6 +57,7 @@ mkdir -p $NETLIFY_CACHE_DIR/.composer mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gopath mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gocache mkdir -p $NETLIFY_CACHE_DIR/.homebrew-cache +mkdir -p $NETLIFY_CACHE_DIR/.cargo : ${YARN_FLAGS=""} : ${NPM_FLAGS=""} @@ -644,6 +645,16 @@ install_dependencies() { fi fi + # Rust + if [ -f Cargo.toml ] || [ -f Cargo.lock ] + then + restore_home_cache ".rustup" "rust rustup cache" + restore_home_cache ".cargo/registry" "rust cargo registry cache" + restore_home_cache ".cargo/bin" "rust cargo bin cache" + restore_cwd_cache "target" "rust compile output" + source $HOME/.cargo/env + fi + # Setup project GOPATH if [ -n "$GO_IMPORT_PATH" ] then @@ -664,6 +675,7 @@ cache_artifacts() { cache_cwd_directory ".venv" "python virtualenv" cache_cwd_directory ".build" "swift build" cache_cwd_directory ".netlify/plugins" "build plugins" + cache_cwd_directory "target" "rust compile output" cache_home_directory ".yarn_cache" "yarn cache" cache_home_directory ".cache/pip" "pip cache" @@ -673,6 +685,9 @@ cache_artifacts() { cache_home_directory ".boot" "boot dependencies" cache_home_directory ".composer" "composer dependencies" cache_home_directory ".homebrew-cache", "homebrew cache" + cache_home_directory ".rustup" "rust rustup cache" + cache_home_directory ".cargo/registry" "rust cargo registry cache" + cache_home_directory ".cargo/bin" "rust cargo bin cache" # Don't follow the Go import path or we'll store # the origin repo twice. diff --git a/run-build.sh b/run-build.sh index 8fc1e2b7..f76e3ecd 100755 --- a/run-build.sh +++ b/run-build.sh @@ -38,4 +38,6 @@ echo "Executing user command: $cmd" eval "$cmd" CODE=$? +cache_artifacts + exit $CODE