Skip to content

Add cache-workspace-crates feature#246

Merged
Swatinem merged 1 commit intoSwatinem:masterfrom
zympler:cache-workspace-crates
Jun 22, 2025
Merged

Add cache-workspace-crates feature#246
Swatinem merged 1 commit intoSwatinem:masterfrom
zympler:cache-workspace-crates

Conversation

@jbransen
Copy link
Contributor

The default caching strategy is to exclude workspace crates, which makes sense for small workspaces, but in cases where the workspace contains libraries which are hardly changed it is nicer to cache the workspace creates as well. This PR adds that option.

Note that setting cache-all-crates = true makes cache-workspace-crates irrelevant, in principle there are only three options now (only dependencies, dependencies+workspace, all), but to keep things backwards compatible I did not want to change the existing options, so I think adding this should be fine.

@jbransen jbransen force-pushed the cache-workspace-crates branch from 17ea91a to f197456 Compare June 21, 2025 10:09
@Swatinem Swatinem merged commit eaa85be into Swatinem:master Jun 22, 2025
22 checks passed
@NobodyXu
Copy link
Contributor

What is the difference between workspace + dep and all?

In a project where the whole repository is a workspace, isn't the two options identical?

@jbransen
Copy link
Contributor Author

No, there can also be dev-dependencies, or conditional dependencies that are only included with feature flags.

With cache-all-crates = true essentially the whole build directory with all intermediate files is cached, while with the other two options there is a cleanup before storing to keep only the relevant files (or some overapproximation, deciding on which files to keep needs a lot of internal cargo info).

@NobodyXu
Copy link
Contributor

Thanks I see, I will try it out and see how it works

@tmm1
Copy link

tmm1 commented Jun 26, 2025

Thank you for adding this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants