Skip to main content

shared_target_core/
lib.rs

1//! Seeding a Cargo target directory from an existing one.
2//!
3//! Cutting a git worktree, or any second checkout, leaves a build that starts
4//! from nothing. Copying `target/` across is the obvious fix and the wrong one:
5//! it is routinely tens of gigabytes. What this crate does instead is build the
6//! new directory out of the old one's storage — a block clone where the
7//! filesystem offers it, and a hard link for the large write-once artifacts
8//! where it does not — so the second tree is warm without being a second copy.
9//!
10//! What belongs here is what Cargo knows: where the target directory is, which
11//! of its contents may be shared, which must be a file of their own, and that a
12//! half-built tree must never be visible under a name Cargo reads. Deciding
13//! *where* the new tree goes is the caller's; a git worktree is one answer and
14//! not a special one.
15
16mod error;
17pub mod lock;
18mod metadata;
19mod probe;
20mod seed;
21
22pub use error::{Error, Result};
23pub use metadata::workspace_target_dir;
24pub use probe::supports_reflink;
25
26pub use seed::{DEFAULT_MIN_SHARED_SIZE, Options, Report, Strategy, seed};