cargo::core::compiler::build_runner::compilation_files

Struct CompilationFiles

Source
pub struct CompilationFiles<'a, 'gctx> {
    pub(super) host: Layout,
    pub(super) target: HashMap<CompileTarget, Layout>,
    export_dir: Option<PathBuf>,
    roots: Vec<Unit>,
    ws: &'a Workspace<'gctx>,
    metas: HashMap<Unit, Metadata>,
    outputs: HashMap<Unit, LazyCell<Arc<Vec<OutputFile>>>>,
}
Expand description

Collection of information about the files emitted by the compiler, and the output directory structure.

Fields§

§host: Layout

The target directory layout for the host (and target if it is the same as host).

§target: HashMap<CompileTarget, Layout>

The target directory layout for the target (if different from then host).

§export_dir: Option<PathBuf>

Additional directory to include a copy of the outputs.

§roots: Vec<Unit>

The root targets requested by the user on the command line (does not include dependencies).

§ws: &'a Workspace<'gctx>§metas: HashMap<Unit, Metadata>

Metadata hash to use for each unit.

§outputs: HashMap<Unit, LazyCell<Arc<Vec<OutputFile>>>>

For each Unit, a list all files produced.

Implementations§

Source§

impl<'a, 'gctx: 'a> CompilationFiles<'a, 'gctx>

Source

pub(super) fn new( build_runner: &BuildRunner<'a, 'gctx>, host: Layout, target: HashMap<CompileTarget, Layout>, ) -> CompilationFiles<'a, 'gctx>

Source

pub fn layout(&self, kind: CompileKind) -> &Layout

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

Source

pub fn metadata(&self, unit: &Unit) -> Metadata

Gets the metadata for the given unit.

See Metadata and fingerprint module for more.

Source

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

Gets the short hash based only on the PackageId. Used for the metadata when metadata returns None.

Source

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

Returns the directory where the artifacts for the given unit are initially created.

Source

pub fn export_dir(&self) -> Option<PathBuf>

Additional export directory from --artifact-dir.

Source

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

Directory name to use for a package in the form NAME-HASH.

Note that some units may share the same directory, so care should be taken in those cases!

Source

pub fn host_dest(&self) -> &Path

Returns the final artifact path for the host (/…/target/debug)

Source

pub fn host_root(&self) -> &Path

Returns the root of the build output tree for the host (/…/target)

Source

pub fn host_deps(&self) -> &Path

Returns the host deps directory path.

Source

pub fn deps_dir(&self, unit: &Unit) -> &Path

Returns the directories where Rust crate dependencies are found for the specified unit.

Source

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

Directory where the fingerprint for the given unit should go.

Source

pub fn fingerprint_file_path(&self, unit: &Unit, prefix: &str) -> PathBuf

Returns the path for a file in the fingerprint directory.

The “prefix” should be something to distinguish the file from other files in the fingerprint directory.

Source

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

Path where compiler output is cached.

Source

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

Returns the directory where a compiled build script is stored. /path/to/target/{debug,release}/build/PKG-HASH

Source

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

Returns the directory for compiled artifacts files. /path/to/target/{debug,release}/deps/artifact/KIND/PKG-HASH

Source

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

Returns the directory where information about running a build script is stored. /path/to/target/{debug,release}/build/PKG-HASH

Source

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

Returns the “OUT_DIR” directory for running a build script. /path/to/target/{debug,release}/build/PKG-HASH/out

Returns the path to the executable binary for the given bin target.

This should only to be used when a Unit is not available.

Source

pub(super) fn outputs( &self, unit: &Unit, bcx: &BuildContext<'a, 'gctx>, ) -> CargoResult<Arc<Vec<OutputFile>>>

Returns the filenames that the given unit will generate.

Note: It is not guaranteed that all of the files will be generated.

Source

fn uplift_to( &self, unit: &Unit, file_type: &FileType, from_path: &Path, ) -> Option<PathBuf>

Returns the path where the output for the given unit and FileType should be uplifted to.

Returns None if the unit shouldn’t be uplifted (for example, a dependent rlib).

Source

fn calc_outputs( &self, unit: &Unit, bcx: &BuildContext<'a, 'gctx>, ) -> CargoResult<Arc<Vec<OutputFile>>>

Calculates the filenames that the given unit will generate. Should use CompilationFiles::outputs instead as it caches the result of this function.

Source

fn calc_outputs_rustc( &self, unit: &Unit, bcx: &BuildContext<'a, 'gctx>, ) -> CargoResult<Vec<OutputFile>>

Computes the actual, full pathnames for all the files generated by rustc.

The OutputFile also contains the paths where those files should be “uplifted” to.

Auto Trait Implementations§

§

impl<'a, 'gctx> Freeze for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !RefUnwindSafe for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !Send for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !Sync for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> Unpin for CompilationFiles<'a, 'gctx>

§

impl<'a, 'gctx> !UnwindSafe for CompilationFiles<'a, 'gctx>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 472 bytes