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>
impl<'a, 'gctx: 'a> CompilationFiles<'a, 'gctx>
pub(super) fn new( build_runner: &BuildRunner<'a, 'gctx>, host: Layout, target: HashMap<CompileTarget, Layout>, ) -> CompilationFiles<'a, 'gctx>
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 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 --artifact-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, 'gctx>,
) -> CargoResult<Arc<Vec<OutputFile>>>
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.
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, 'gctx>,
) -> CargoResult<Arc<Vec<OutputFile>>>
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.
Sourcefn calc_outputs_rustc(
&self,
unit: &Unit,
bcx: &BuildContext<'a, 'gctx>,
) -> CargoResult<Vec<OutputFile>>
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> 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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§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>,
§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