Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #477 from cecton/rust
Browse files Browse the repository at this point in the history
Add Rust support
  • Loading branch information
vbrown608 committed Dec 7, 2020
2 parents 8a965d0 + 23b30a7 commit 53b83b6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions included_software.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=""}
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions run-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ echo "Executing user command: $cmd"
eval "$cmd"
CODE=$?

cache_artifacts

exit $CODE

0 comments on commit 53b83b6

Please sign in to comment.