Faster Rust builds!
cargo-green
: Cargo plugin to sandbox, cache & remote execcargo
buildsrustcbuildx
:$RUSTC_WRAPPER
tool to sandboxcargo
builds and execute jobs remotely
- seamlessly build on another machine (with more cores, more cache)
- support remote builds by setting env
DOCKER_HOST=
with e.g.ssh://me@beaffy-machine.internal.net
- Build cache is saved remotely, artifacts are saved locally
- Tests building happens on remote machine, execution happens on local machine
- support remote builds by setting env
- seamlessly integrate with normal
cargo
usage- only pull sources from local filesystem
- produce the same intermediary artefacts as local
cargo
does - fallback to normal, local
rustc
anytime- switching from this wrapper back to local
rustc
does necessitate a fresh build
- switching from this wrapper back to local
- wrap
rustc
calls inbuildkit
-like calls (docker
,podman
)-
docker
-
podman
- deps compatibility
- handle Rust-only deps
- handle all the other deps (expand this list) (use
crater
)-
C
deps - ...
-
- runner compatibility
- set
.dockerignore
s (to be authoritative on srcs)
- set
- trace these outputs (STDOUT/STDERR) for debugging
-
- available as a
rustc
wrapper through$RUSTC_WRAPPER
- available as a
cargo
subcommand- configuration profiles (user, team, per-workspace, per-crate, CI, ...)
- seamlessly use current/local
rustc
version- support overriding
rustc
base image
- support overriding
- seamlessly use current/local tools (
mold
, ...)- config expressions on top of base image config?
- just suggest an inline
Dockerfile
stage?
- support CRUD-ish operations on local/remotes cache
-
[SEC]
support building a crate without it having network access
- integrate with shipping OCI images
- share cache with the World
- never rebuild a dep (for a given version of
rustc
, ...) - share cache with other projects on local machine
- fix
WORKDIR
s + rewrite paths withremap-path-prefix
- fix
- share cache with CI and team
- share cache with CI (at least for a single user)
-
[SEC]
ensure private deps don't leak through/to cache - CLI gives the Dockerfile that
cargo install
's any crate
- never rebuild a dep (for a given version of
- suggest a global cache -faciliting configuration profile
- integrate with
cross
- build for a non-local target
PoC originally written in Bash: https://github.com/fenollp/buildxargs/blob/buildx/tryin.sh
See ./hack/