Struct cargo::ops::Context [] [src]

pub struct Context<'a, 'cfg: 'a> {
    pub config: &'cfg Config,
    pub resolve: &'a Resolve,
    pub compilation: Compilation<'cfg>,
    pub packages: &'a PackageSet<'cfg>,
    pub build_state: Arc<BuildState>,
    pub build_explicit_deps: HashMap<Unit<'a>, (PathBuf, Vec<String>)>,
    pub exec_engine: Arc<Box<ExecEngine>>,
    pub fingerprints: HashMap<Unit<'a>, Arc<Fingerprint>>,
    pub compiled: HashSet<Unit<'a>>,
    pub build_config: BuildConfig,
    pub build_scripts: HashMap<Unit<'a>, Arc<BuildScripts>>,
    pub links: Links<'a>,
    // some fields omitted
}

Fields

config: &'cfg Config resolve: &'a Resolve compilation: Compilation<'cfg> packages: &'a PackageSet<'cfg> build_state: Arc<BuildState> build_explicit_deps: HashMap<Unit<'a>, (PathBuf, Vec<String>)> exec_engine: Arc<Box<ExecEngine>> fingerprints: HashMap<Unit<'a>, Arc<Fingerprint>> compiled: HashSet<Unit<'a>> build_config: BuildConfig build_scripts: HashMap<Unit<'a>, Arc<BuildScripts>> links: Links<'a>

Methods

impl<'a, 'cfg> Context<'a, 'cfg>
[src]

fn new(resolve: &'a Resolve, packages: &'a PackageSet<'cfg>, config: &'cfg Config, host: Layout, target_layout: Option<Layout>, build_config: BuildConfig, profiles: &'a Profiles) -> CargoResult<Context<'a, 'cfg>>

fn prepare(&mut self, root: &Package) -> CargoResult<()>

Prepare this context, ensuring that all filesystem directories are in place.

fn probe_target_info(&mut self, units: &[Unit<'a>]) -> CargoResult<()>

Ensure that we've collected all target-specific information to compile all the units mentioned in units.

fn layout(&self, pkg: &Package, kind: Kind) -> LayoutProxy

Returns the appropriate directory layout for either a plugin or not.

fn out_dir(&self, unit: &Unit) -> PathBuf

Returns the appropriate output directory for the specified package and target.

fn target_triple(&self) -> &str

Return the target triple which this context is targeting.

fn target_metadata(&self, unit: &Unit) -> Option<Metadata>

Get the metadata for a target in a specific profile

fn file_stem(&self, unit: &Unit) -> String

Returns the file stem for a given target/profile combo

fn target_filenames(&self, unit: &Unit) -> CargoResult<Vec<(String, bool)>>

Return the filenames that the given target for the given profile will generate, along with whether you can link against that file (e.g. it's a library).

fn dep_targets(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>>

For a package, return all targets which are registered as dependencies for that package.

fn dep_run_custom_build(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>>

Returns the dependencies needed to run a build script.

The unit provided must represent an execution of a build script, and the returned set of units must all be run before unit is run.

fn get_package(&self, id: &PackageId) -> CargoResult<&'a Package>

Gets a package for the given package id.

fn linker(&self, kind: Kind) -> Option<&Path>

Get the user-specified linker for a particular host or target

fn ar(&self, kind: Kind) -> Option<&Path>

Get the user-specified ar program for a particular host or target

fn jobs(&self) -> u32

Number of jobs specified for this build

fn requested_target(&self) -> Option<&str>

Requested (not actual) target for the build

fn lib_profile(&self, _pkg: &PackageId) -> &'a Profile

fn build_script_profile(&self, pkg: &PackageId) -> &'a Profile

fn rustflags_args(&self, unit: &Unit) -> CargoResult<Vec<String>>

fn show_warnings(&self, pkg: &PackageId) -> bool