use core::{TargetKind, Workspace};
use ops::cargo_rustc::layout::Layout;
-use ops::cargo_rustc::TargetFileType;
+use ops::cargo_rustc::FileFlavor;
use ops::{Context, Kind, Unit};
use util::{self, CargoResult};
/// - If it should be linked into `target`, and what it should be called (e.g. without
/// metadata).
/// - Type of the file (library / debug symbol / else)
- outputs: HashMap<Unit<'a>, LazyCell<Arc<Vec<(PathBuf, Option<PathBuf>, TargetFileType)>>>>,
+ outputs: HashMap<Unit<'a>, LazyCell<Arc<Vec<(PathBuf, Option<PathBuf>, FileFlavor)>>>>,
}
impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
&self,
unit: &Unit<'a>,
cx: &Context<'a, 'cfg>,
- ) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, TargetFileType)>>> {
+ ) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, FileFlavor)>>> {
self.outputs[unit]
.try_borrow_with(|| self.calc_target_filenames(unit, cx))
.map(Arc::clone)
&self,
unit: &Unit<'a>,
cx: &Context<'a, 'cfg>,
- ) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, TargetFileType)>>> {
+ ) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, FileFlavor)>>> {
let out_dir = self.out_dir(unit);
let file_stem = self.file_stem(unit);
let link_stem = self.link_stem(unit);
let link_dst = link_stem
.clone()
.map(|(ld, ls)| ld.join(format!("lib{}.rmeta", ls)));
- ret.push((filename, link_dst, TargetFileType::Linkable));
+ ret.push((filename, link_dst, FileFlavor::Linkable));
} else {
- let mut add = |crate_type: &str, file_type: TargetFileType| -> CargoResult<()> {
+ let mut add = |crate_type: &str, file_type: FileFlavor| -> CargoResult<()> {
let crate_type = if crate_type == "lib" {
"rlib"
} else {
file_type.suffix
))
});
- ret.push((filename, link_dst, file_type.target_file_type));
+ ret.push((filename, link_dst, file_type.flavor));
}
}
// not supported, don't worry about it
| TargetKind::ExampleBin
| TargetKind::Bench
| TargetKind::Test => {
- add("bin", TargetFileType::Normal)?;
+ add("bin", FileFlavor::Normal)?;
}
TargetKind::Lib(..) | TargetKind::ExampleLib(..) if unit.profile.test => {
- add("bin", TargetFileType::Normal)?;
+ add("bin", FileFlavor::Normal)?;
}
TargetKind::ExampleLib(ref kinds) | TargetKind::Lib(ref kinds) => {
for kind in kinds {
add(
kind.crate_type(),
if kind.linkable() {
- TargetFileType::Linkable
+ FileFlavor::Linkable
} else {
- TargetFileType::Normal
+ FileFlavor::Normal
},
)?;
}
pub use self::compilation_files::Metadata;
mod target_info;
-pub use self::target_info::TargetFileType;
+pub use self::target_info::FileFlavor;
use self::target_info::TargetInfo;
/// All information needed to define a Unit.
pub fn target_filenames(
&mut self,
unit: &Unit<'a>,
- ) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, TargetFileType)>>> {
+ ) -> CargoResult<Arc<Vec<(PathBuf, Option<PathBuf>, FileFlavor)>>> {
self.files.as_ref().unwrap().target_filenames(unit, self)
}
/// Type of each file generated by a Unit.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub enum TargetFileType {
+pub enum FileFlavor {
/// Not a special file type.
Normal,
/// It is something you can link against (e.g. a library)
pub struct FileType {
pub suffix: String,
pub prefix: String,
- pub target_file_type: TargetFileType,
+ pub flavor: FileFlavor,
pub should_replace_hyphens: bool,
}
pub fn file_types(
&self,
crate_type: &str,
- file_type: TargetFileType,
+ file_type: FileFlavor,
kind: &TargetKind,
target_triple: &str,
) -> CargoResult<Option<Vec<FileType>>> {
FileType {
suffix: suffix.to_string(),
prefix: prefix.clone(),
- target_file_type: file_type,
+ flavor: file_type,
should_replace_hyphens: false,
},
];
ret.push(FileType {
suffix: ".dll.lib".to_string(),
prefix: prefix.clone(),
- target_file_type: TargetFileType::Normal,
+ flavor: FileFlavor::Normal,
should_replace_hyphens: false,
})
}
ret.push(FileType {
suffix: ".wasm".to_string(),
prefix: prefix.clone(),
- target_file_type: TargetFileType::Normal,
+ flavor: FileFlavor::Normal,
should_replace_hyphens: true,
})
}
ret.push(FileType {
suffix: ".dSYM".to_string(),
prefix: prefix.clone(),
- target_file_type: TargetFileType::DebugInfo,
+ flavor: FileFlavor::DebugInfo,
should_replace_hyphens: false,
})
} else if target_triple.ends_with("-msvc") {
ret.push(FileType {
suffix: ".pdb".to_string(),
prefix: prefix.clone(),
- target_file_type: TargetFileType::DebugInfo,
+ flavor: FileFlavor::DebugInfo,
should_replace_hyphens: false,
})
}
use util::paths;
use super::job::Work;
-use super::context::{Context, TargetFileType, Unit};
+use super::context::{Context, FileFlavor, Unit};
use super::custom_build::BuildDeps;
/// A tuple result of the `prepare_foo` functions in this module.
.exists();
} else {
for &(ref src, ref link_dst, file_type) in cx.target_filenames(unit)?.iter() {
- if file_type == TargetFileType::DebugInfo {
+ if file_type == FileFlavor::DebugInfo {
continue;
}
missing_outputs |= !src.exists();
use self::output_depinfo::output_depinfo;
pub use self::compilation::Compilation;
-pub use self::context::{Context, TargetFileType, Unit};
+pub use self::context::{Context, FileFlavor, Unit};
pub use self::custom_build::{BuildMap, BuildOutput, BuildScripts};
pub use self::layout::is_bad_artifact_name;
for unit in units.iter() {
for &(ref dst, ref link_dst, file_type) in cx.target_filenames(unit)?.iter() {
- if file_type == TargetFileType::DebugInfo {
+ if file_type == FileFlavor::DebugInfo {
continue;
}
dep: &Unit<'a>,
) -> CargoResult<()> {
for &(ref dst, _, file_type) in cx.target_filenames(dep)?.iter() {
- if file_type != TargetFileType::Linkable {
+ if file_type != FileFlavor::Linkable {
continue;
}
let mut v = OsString::new();