Struct cargo::ops::Context
[−]
[src]
pub struct Context<'a, 'cfg: 'a> { pub ws: &'a Workspace<'cfg>, 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>, BuildDeps>, 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>, pub used_in_plugin: HashSet<Unit<'a>>, pub jobserver: Client, // some fields omitted }
Fields
ws: &'a Workspace<'cfg>
config: &'cfg Config
resolve: &'a Resolve
compilation: Compilation<'cfg>
packages: &'a PackageSet<'cfg>
build_state: Arc<BuildState>
build_explicit_deps: HashMap<Unit<'a>, BuildDeps>
fingerprints: HashMap<Unit<'a>, Arc<Fingerprint>>
compiled: HashSet<Unit<'a>>
build_config: BuildConfig
build_scripts: HashMap<Unit<'a>, Arc<BuildScripts>>
links: Links<'a>
used_in_plugin: HashSet<Unit<'a>>
jobserver: Client
Methods
impl<'a, 'cfg> Context<'a, 'cfg>
[src]
fn new(
ws: &'a Workspace<'cfg>,
resolve: &'a Resolve,
packages: &'a PackageSet<'cfg>,
config: &'cfg Config,
build_config: BuildConfig,
profiles: &'a Profiles
) -> CargoResult<Context<'a, 'cfg>>
[src]
ws: &'a Workspace<'cfg>,
resolve: &'a Resolve,
packages: &'a PackageSet<'cfg>,
config: &'cfg Config,
build_config: BuildConfig,
profiles: &'a Profiles
) -> CargoResult<Context<'a, 'cfg>>
fn prepare(&mut self) -> CargoResult<()>
[src]
Prepare this context, ensuring that all filesystem directories are in place.
fn probe_target_info(&mut self, units: &[Unit<'a>]) -> CargoResult<()>
[src]
Ensure that we've collected all target-specific information to compile
all the units mentioned in units
.
fn build_used_in_plugin_map(&mut self, units: &[Unit<'a>]) -> CargoResult<()>
[src]
Builds up the used_in_plugin
internal to this context from the list of
top-level units.
This will recursively walk units
and all of their dependencies to
determine which crate are going to be used in plugins or not.
fn deps_dir(&self, unit: &Unit) -> &Path
[src]
Returns the directories where Rust crate dependencies are found for the specified unit.
fn fingerprint_dir(&mut self, unit: &Unit) -> PathBuf
[src]
Returns the directory for the specified unit where fingerprint information is stored.
fn build_script_dir(&mut self, unit: &Unit) -> PathBuf
[src]
Returns the appropriate directory layout for either a plugin or not.
fn build_script_out_dir(&mut self, unit: &Unit) -> PathBuf
[src]
Returns the appropriate directory layout for either a plugin or not.
fn host_deps(&self) -> &Path
[src]
fn target_root(&self) -> &Path
[src]
Return the root of the build output tree
fn out_dir(&mut self, unit: &Unit) -> PathBuf
[src]
Returns the appropriate output directory for the specified package and target.
fn host_triple(&self) -> &str
[src]
Return the host triple for this context
fn target_triple(&self) -> &str
[src]
Return the target triple which this context is targeting.
fn requested_target(&self) -> Option<&str>
[src]
Requested (not actual) target for the build
fn target_short_hash(&self, unit: &Unit) -> String
[src]
Get the short hash based only on the PackageId Used for the metadata when target_metadata returns None
fn target_metadata(&mut self, unit: &Unit) -> Option<Metadata>
[src]
Get the metadata for a target in a specific profile
We build to the path: "{filename}-{target_metadata}"
We use a linking step to link/copy to a predictable filename
like target/debug/libfoo.{a,so,rlib}
and such.
fn file_stem(&mut self, unit: &Unit) -> String
[src]
Returns the file stem for a given target/profile combo (with metadata)
fn link_stem(&mut self, unit: &Unit) -> Option<(PathBuf, String)>
[src]
Returns a tuple with the directory and name of the hard link we expect our target to be copied to. Eg, file_stem may be out_dir/deps/foo-abcdef and link_stem would be out_dir/foo This function returns it in two parts so the caller can add prefix/suffix to filename separately Returns an Option because in some cases we don't want to link (eg a dependent lib)
fn target_filenames(
&mut self,
unit: &Unit<'a>
) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, bool)>>>
[src]
&mut self,
unit: &Unit<'a>
) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, bool)>>>
Return the filenames that the given target for the given profile will generate as a list of 3-tuples (filename, link_dst, linkable) filename: filename rustc compiles to. (Often has metadata suffix). link_dst: Optional file to link/copy the result to (without metadata suffix) linkable: Whether possible to link against file (eg it's a library)
fn dep_targets(&self, unit: &Unit<'a>) -> CargoResult<Vec<Unit<'a>>>
[src]
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>>>
[src]
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>
[src]
Gets a package for the given package id.
fn linker(&self, kind: Kind) -> Option<&Path>
[src]
Get the user-specified linker for a particular host or target
fn ar(&self, kind: Kind) -> Option<&Path>
[src]
Get the user-specified ar
program for a particular host or target
fn cfg(&self, kind: Kind) -> &[Cfg]
[src]
Get the list of cfg printed out from the compiler for the specified kind
fn jobs(&self) -> u32
[src]
Number of jobs specified for this build