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

Commit 53b83b6

Browse files
authored
Merge pull request #477 from cecton/rust
Add Rust support
2 parents 8a965d0 + 23b30a7 commit 53b83b6

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,14 @@ RUN brew tap homebrew/bundle
485485

486486
WORKDIR /
487487

488+
################################################################################
489+
#
490+
# rustup
491+
#
492+
################################################################################
493+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none
494+
ENV PATH "$PATH:/opt/buildhome/.cargo/bin"
495+
488496
# Cleanup
489497
USER root
490498

included_software.md

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ The specific patch versions included will depend on when the image was last buil
3636
* Not installed by default.
3737
* Supports any version that `swiftenv` can install later than `4.x`. Versions `4.x` and earlier will not work due to incompatible shared libraries.
3838
* 5.2 is installed if `Package.swift` is present and no version is specified with `SWIFT_VERSION` or `.swift-version`.
39+
* Rust
40+
* Not installed by default.
41+
* Supports any version that `rustup` can install.
3942

4043
### Tools
4144

run-build-functions.sh

+15
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ mkdir -p $NETLIFY_CACHE_DIR/.composer
5757
mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gopath
5858
mkdir -p $NETLIFY_CACHE_DIR/.gimme_cache/gocache
5959
mkdir -p $NETLIFY_CACHE_DIR/.homebrew-cache
60+
mkdir -p $NETLIFY_CACHE_DIR/.cargo
6061

6162
: ${YARN_FLAGS=""}
6263
: ${NPM_FLAGS=""}
@@ -644,6 +645,16 @@ install_dependencies() {
644645
fi
645646
fi
646647

648+
# Rust
649+
if [ -f Cargo.toml ] || [ -f Cargo.lock ]
650+
then
651+
restore_home_cache ".rustup" "rust rustup cache"
652+
restore_home_cache ".cargo/registry" "rust cargo registry cache"
653+
restore_home_cache ".cargo/bin" "rust cargo bin cache"
654+
restore_cwd_cache "target" "rust compile output"
655+
source $HOME/.cargo/env
656+
fi
657+
647658
# Setup project GOPATH
648659
if [ -n "$GO_IMPORT_PATH" ]
649660
then
@@ -664,6 +675,7 @@ cache_artifacts() {
664675
cache_cwd_directory ".venv" "python virtualenv"
665676
cache_cwd_directory ".build" "swift build"
666677
cache_cwd_directory ".netlify/plugins" "build plugins"
678+
cache_cwd_directory "target" "rust compile output"
667679

668680
cache_home_directory ".yarn_cache" "yarn cache"
669681
cache_home_directory ".cache/pip" "pip cache"
@@ -673,6 +685,9 @@ cache_artifacts() {
673685
cache_home_directory ".boot" "boot dependencies"
674686
cache_home_directory ".composer" "composer dependencies"
675687
cache_home_directory ".homebrew-cache", "homebrew cache"
688+
cache_home_directory ".rustup" "rust rustup cache"
689+
cache_home_directory ".cargo/registry" "rust cargo registry cache"
690+
cache_home_directory ".cargo/bin" "rust cargo bin cache"
676691

677692
# Don't follow the Go import path or we'll store
678693
# the origin repo twice.

run-build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,6 @@ echo "Executing user command: $cmd"
3838
eval "$cmd"
3939
CODE=$?
4040

41+
cache_artifacts
42+
4143
exit $CODE

0 commit comments

Comments
 (0)