Struct cargo::core::compiler::context::compilation_files::CompilationFiles
source · pub struct CompilationFiles<'a, 'cfg> {
pub(super) host: Layout,
pub(super) target: HashMap<CompileTarget, Layout>,
export_dir: Option<PathBuf>,
roots: Vec<Unit>,
ws: &'a Workspace<'cfg>,
metas: HashMap<Unit, MetaInfo>,
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<'cfg>
§metas: HashMap<Unit, MetaInfo>
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, 'cfg: 'a> CompilationFiles<'a, 'cfg>
impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg>
pub(super) fn new( cx: &Context<'a, 'cfg>, host: Layout, target: HashMap<CompileTarget, Layout> ) -> CompilationFiles<'a, 'cfg>
sourcepub fn layout(&self, kind: CompileKind) -> &Layout
pub fn layout(&self, kind: CompileKind) -> &Layout
Returns the appropriate directory layout for either a plugin or not.
sourcepub fn metadata(&self, unit: &Unit) -> Metadata
pub fn metadata(&self, unit: &Unit) -> Metadata
Gets the metadata for the given unit.
See Metadata
and fingerprint
module for more.
sourcepub fn use_extra_filename(&self, unit: &Unit) -> bool
pub fn use_extra_filename(&self, unit: &Unit) -> bool
Returns whether or not -C extra-filename
is used to extend the
output filenames to make them unique.
sourcepub fn target_short_hash(&self, unit: &Unit) -> String
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
.
sourcepub fn out_dir(&self, unit: &Unit) -> PathBuf
pub fn out_dir(&self, unit: &Unit) -> PathBuf
Returns the directory where the artifacts for the given unit are initially created.
sourcepub fn export_dir(&self) -> Option<PathBuf>
pub fn export_dir(&self) -> Option<PathBuf>
Additional export directory from --out-dir
.
sourcefn pkg_dir(&self, unit: &Unit) -> String
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!
sourcepub fn host_dest(&self) -> &Path
pub fn host_dest(&self) -> &Path
Returns the final artifact path for the host (/…/target/debug
)
sourcepub fn host_root(&self) -> &Path
pub fn host_root(&self) -> &Path
Returns the root of the build output tree for the host (/…/target
)
sourcepub fn deps_dir(&self, unit: &Unit) -> &Path
pub fn deps_dir(&self, unit: &Unit) -> &Path
Returns the directories where Rust crate dependencies are found for the specified unit.
sourcepub fn fingerprint_dir(&self, unit: &Unit) -> PathBuf
pub fn fingerprint_dir(&self, unit: &Unit) -> PathBuf
Directory where the fingerprint for the given unit should go.
sourcepub fn fingerprint_file_path(&self, unit: &Unit, prefix: &str) -> PathBuf
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.
sourcepub fn message_cache_path(&self, unit: &Unit) -> PathBuf
pub fn message_cache_path(&self, unit: &Unit) -> PathBuf
Path where compiler output is cached.
sourcepub fn build_script_dir(&self, unit: &Unit) -> PathBuf
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
sourcefn artifact_dir(&self, unit: &Unit) -> PathBuf
fn artifact_dir(&self, unit: &Unit) -> PathBuf
Returns the directory for compiled artifacts files.
/path/to/target/{debug,release}/deps/artifact/KIND/PKG-HASH
sourcepub fn build_script_run_dir(&self, unit: &Unit) -> PathBuf
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
sourcepub fn build_script_out_dir(&self, unit: &Unit) -> PathBuf
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
sourcepub fn bin_link_for_target(
&self,
target: &Target,
kind: CompileKind,
bcx: &BuildContext<'_, '_>
) -> CargoResult<PathBuf>
pub fn bin_link_for_target( &self, target: &Target, kind: CompileKind, bcx: &BuildContext<'_, '_> ) -> CargoResult<PathBuf>
Returns the path to the executable binary for the given bin target.
This should only to be used when a Unit
is not available.
sourcepub(super) fn outputs(
&self,
unit: &Unit,
bcx: &BuildContext<'a, 'cfg>
) -> CargoResult<Arc<Vec<OutputFile>>>
pub(super) fn outputs( &self, unit: &Unit, bcx: &BuildContext<'a, 'cfg> ) -> 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.
sourcefn uplift_to(
&self,
unit: &Unit,
file_type: &FileType,
from_path: &Path
) -> Option<PathBuf>
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).
sourcefn calc_outputs(
&self,
unit: &Unit,
bcx: &BuildContext<'a, 'cfg>
) -> CargoResult<Arc<Vec<OutputFile>>>
fn calc_outputs( &self, unit: &Unit, bcx: &BuildContext<'a, 'cfg> ) -> 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.
sourcefn calc_outputs_rustc(
&self,
unit: &Unit,
bcx: &BuildContext<'a, 'cfg>
) -> CargoResult<Vec<OutputFile>>
fn calc_outputs_rustc( &self, unit: &Unit, bcx: &BuildContext<'a, 'cfg> ) -> 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, 'cfg> !RefUnwindSafe for CompilationFiles<'a, 'cfg>
impl<'a, 'cfg> !Send for CompilationFiles<'a, 'cfg>
impl<'a, 'cfg> !Sync for CompilationFiles<'a, 'cfg>
impl<'a, 'cfg> Unpin for CompilationFiles<'a, 'cfg>
impl<'a, 'cfg> !UnwindSafe for CompilationFiles<'a, 'cfg>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
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