rust-ecosystem icon indicating copy to clipboard operation
rust-ecosystem copied to clipboard

Share build cache between projects on local machine

Open repi opened this issue 6 years ago • 3 comments

Current build cache intermediate files are local for each workspace, so if a crate is used in multiple different projects/workspaces one builds it multiple times on the same machine.

This slows down development and iteration times, esp. when jumping between tons of different projects or crates as one have to rebuild a lot of common dependencies.

This is less of a problem for our own code as we have all of it in a single monorepo and Cargo workspace.

Discussion thread: [Idea] Cargo Global Binary Cache

Issue:

repi avatar Apr 01 '19 20:04 repi

Have you tried using sccache? It's kinda easy for it to trip up but it works in the common case and when it does fail the worst that happens (in my experience) is that i fails to notice that it can use a previous build and you fail to skip over a build that it could have used a cache for.

Lokathor avatar Dec 02 '19 04:12 Lokathor

We do use sccache on our CI with some good wins, but few use it locally. Do want a solution that is super easy for local user, and require little / no setup.

But maybe sccache could be set up locally with say a single command and work on all platforms

repi avatar Dec 02 '19 08:12 repi

On linux the setup to just use a local cache was a snap. You install via cargo, then you change your login script so that it sets the environment variable they talk about.

I have yet to try it on windows, my builds are currently sufficiently fast on that platform.

Lokathor avatar Dec 02 '19 09:12 Lokathor