- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.7k
 
Open
Labels
A-cachingArea: caching of dependencies, repositories, and build artifactsArea: caching of dependencies, repositories, and build artifactsS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
MVP design: cache intermediate artifacts across projects with minimal cache poisoning
- Only immutable items (registry, git, not path)
 - Idempotent builds (no build script executions + dependents, no proc macro dependents)
 
Roadmap:
-  Split out a 
build-dirto communicate out early what will be broken (RedefineCARGO_TARGET_DIRto be only an artifacts directory #14125) -  Re-organize 
build-dirinto cacheable units (Re-organize build-dir by package + hash, rather than artifact type #15010) -  Experiments
-  More granular locking in 
build-dirto see what could apply to a shared cache (More granular locking in cargo_rustc #4282) -  GC for 
build-dirin prep for GC for shared cache (cargo ./target fills with outdated artifacts as toolchains are updated/changed #5026) - Implement shared cache without gc and with coarse locking
 
 -  More granular locking in 
 -  Polish shared cache
- GC
 - granular locking
 
 
Parallel efforts to improve cache efficiency
- Reduce the need for users to write build scripts #14948
 - Tracking issue for RFC 2196, "metabuild: semantic build scripts for Cargo" #14903
 - Tracking Issue for RFC 3698 "Declarative 
macro_rules!derive macros" (macro_derive) rust#143549 - Tracking Issue for RFC 3697 "Declarative 
macro_rules!attribute macros" (macro_attr) rust#143547 
Future possibilities
- Remote cache plugin system
 - Means for proc-macros and build scripts to be cached
- Pinky promise flag to be cacheable
 - Means for guarenteeing they are only accessing declared resources
 
 
Open questions
- How does this interact with 
cargo clean? - How does this interact with pipelined builds?
 
I was wondering if anyone has contemplated somehow sharing compiled crates. If I have a number of projects on disk that often have similar dependencies, I'm spending a lot of time recompiling the same packages. (Even correcting for features, compiler flags and compilation profiles.) Would it make sense to store symlinks in ~/.cargo or equivalent pointing to compiled artefacts?
matthiaskrgr, weihanglo, PSeitz, SergeiMinaev, Kobzol and 42 more
Metadata
Metadata
Assignees
Labels
A-cachingArea: caching of dependencies, repositories, and build artifactsArea: caching of dependencies, repositories, and build artifactsS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.