pub fn prepare<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
                         -> CargoResult<(Work, Work, Freshness)> {
    let _p = profile::start(format!("build script prepare: {}/{}",
                                    unit.pkg, unit.target.name()));
    let key = (unit.pkg.package_id().clone(), unit.kind);
    let overridden = cx.build_state.outputs.lock().unwrap().contains_key(&key);
    let (work_dirty, work_fresh) = if overridden {
        (Work::new(|_| Ok(())), Work::new(|_| Ok(())))
    } else {
        try!(build_work(cx, unit))
    };

    // Now that we've prep'd our work, build the work needed to manage the
    // fingerprint and then start returning that upwards.
    let (freshness, dirty, fresh) =
            try!(fingerprint::prepare_build_cmd(cx, unit));

    Ok((work_dirty.then(dirty), work_fresh.then(fresh), freshness))
}
/// Prepares a `Work` that executes the target as a custom build script.
///
/// The `req` given is the requirement which this run of the build script will
/// prepare work for. If the requirement is specified as both the target and the
/// host platforms it is assumed that the two are equal and the build script is
/// only run once (not twice).
Prepares a `Work` that executes the target as a custom build script.
The `req` given is the requirement which this run of the build script will
prepare work for. If the requirement is specified as both the target and the
host platforms it is assumed that the two are equal and the build script is
only run once (not twice).
Prepares a ` Work ` that executes the target as a custom build script . The ` req ` given is the requirement which this run of the build script will prepare work for . If the requirement is specified as both the target and the host platforms it is assumed that the two are equal and the build script is only run once ( not twice ) .
pub fn prepare<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>)
                         -> CargoResult<(Work, Work, Freshness)> {
    let _p = profile::start(format!("build script prepare: {}/{}",
                                    unit.pkg, unit.target.name()));
    let key = (unit.pkg.package_id().clone(), unit.kind);
    let overridden = cx.build_state.outputs.lock().unwrap().contains_key(&key);
    let (work_dirty, work_fresh) = if overridden {
        (Work::new(|_| Ok(())), Work::new(|_| Ok(())))
    } else {
        try!(build_work(cx, unit))
    };
    // Now that we've prep'd our work, build the work needed to manage the
    // fingerprint and then start returning that upwards.
    let (freshness, dirty, fresh) =
            try!(fingerprint::prepare_build_cmd(cx, unit));
    Ok((work_dirty.then(dirty), work_fresh.then(fresh), freshness))
}
pub fn prepare < ' a , ' cfg > ( cx : & mut Context < ' a , ' cfg > , unit : & Unit < ' a > ) -> CargoResult < ( Work , Work , Freshness ) > { let _p = profile :: start ( format ! ( " " unit pkg unit target name ( ) ) ) ; let key = ( unit . pkg . package_id ( ) . clone ( ) , unit . kind ) ; let overridden = cx . build_state . outputs . lock ( ) . unwrap ( ) . contains_key ( & key ) ; let ( work_dirty , work_fresh ) = if overridden { ( Work :: new ( | _ | Ok ( ( ) ) ) , Work :: new ( | _ | Ok ( ( ) ) ) ) } else { try ! ( build_work ( cx unit ) ) } ; // Now that we've prep'd our work, build the work needed to manage the // fingerprint and then start returning that upwards. let ( freshness , dirty , fresh ) = try ! ( fingerprint prepare_build_cmd ( cx unit ) ) ; Ok ( ( work_dirty . then ( dirty ) , work_fresh . then ( fresh ) , freshness ) ) }
Prepares a `Work` that executes the target as a custom build script.
Prepares a ` Work ` that executes the target as a custom build script .
cx
&mut Context<'a, 'cfg>
unit
&Unit<'a>
cx
&mut Context<'a, 'cfg>
unit
&Unit<'a>