Function cargo::core::compiler::fingerprint::prepare_target

source ·
pub fn prepare_target(
    build_runner: &mut BuildRunner<'_, '_>,
    unit: &Unit,
    force: bool,
) -> CargoResult<Job>
Expand description

Determines if a Unit is up-to-date, and if not prepares necessary work to update the persisted fingerprint.

This function will inspect Unit, calculate a fingerprint for it, and then return an appropriate Job to run. The returned Job will be a noop if unit is considered “fresh”, or if it was previously built and cached. Otherwise the Job returned will write out the true fingerprint to the filesystem, to be executed after the unit’s work has completed.

The force flag is a way to force the Job to be “dirty”, or always update the fingerprint. Beware using this flag because it does not transitively propagate throughout the dependency graph, it only forces this one unit which is very unlikely to be what you want unless you’re exclusively talking about top-level units.