pub struct BuildContext<'a, 'cfg> {
pub ws: &'a Workspace<'cfg>,
pub config: &'cfg Config,
pub profiles: Profiles,
pub build_config: &'a BuildConfig,
pub extra_compiler_args: HashMap<Unit<'a>, Vec<String>>,
pub packages: &'a PackageSet<'cfg>,
pub units: &'a UnitInterner<'a>,
pub target_data: RustcTargetData,
pub skip_units: RefCell<HashSet<Unit<'a>>>,
}Expand description
The build context, containing all information about a build task.
It is intended that this is mostly static information. Stuff that mutates
during the build can be found in the parent Context. (I say mostly,
because this has internal caching, but nothing that should be observable
or require &mut.)
Fields§
§ws: &'a Workspace<'cfg>The workspace the build is for.
config: &'cfg ConfigThe cargo configuration.
profiles: Profiles§build_config: &'a BuildConfig§extra_compiler_args: HashMap<Unit<'a>, Vec<String>>Extra compiler args for either rustc or rustdoc.
packages: &'a PackageSet<'cfg>Package downloader.
units: &'a UnitInterner<'a>Source of interning new units as they’re created.
target_data: RustcTargetDataInformation about rustc and the target platform.
skip_units: RefCell<HashSet<Unit<'a>>>Units which should be skipped, use in dependency builds
Implementations§
Source§impl<'a, 'cfg> BuildContext<'a, 'cfg>
impl<'a, 'cfg> BuildContext<'a, 'cfg>
pub fn new( ws: &'a Workspace<'cfg>, packages: &'a PackageSet<'cfg>, config: &'cfg Config, build_config: &'a BuildConfig, profiles: Profiles, units: &'a UnitInterner<'a>, extra_compiler_args: HashMap<Unit<'a>, Vec<String>>, target_data: RustcTargetData, ) -> CargoResult<BuildContext<'a, 'cfg>>
pub fn rustc(&self) -> &Rustc
Sourcepub fn linker(&self, kind: CompileKind) -> Option<PathBuf>
pub fn linker(&self, kind: CompileKind) -> Option<PathBuf>
Gets the user-specified linker for a particular host or target.
Sourcepub fn host_triple(&self) -> InternedString
pub fn host_triple(&self) -> InternedString
Gets the host architecture triple.
For example, x86_64-unknown-linux-gnu, would be
- machine: x86_64,
- hardware-platform: unknown,
- operating system: linux-gnu.
pub fn rustflags_args(&self, unit: &Unit<'_>) -> &[String]
pub fn rustdocflags_args(&self, unit: &Unit<'_>) -> &[String]
pub fn show_warnings(&self, pkg: PackageId) -> bool
pub fn extra_args_for(&self, unit: &Unit<'a>) -> Option<&Vec<String>>
Sourcepub fn script_override(
&self,
lib_name: &str,
kind: CompileKind,
) -> Option<&BuildOutput>
pub fn script_override( &self, lib_name: &str, kind: CompileKind, ) -> Option<&BuildOutput>
If a build script is overridden, this returns the BuildOutput to use.
lib_name is the links library name and kind is whether it is for
Host or Target.