Rename TargetFileType -> FileFlavor
authorAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 2 Apr 2018 20:55:57 +0000 (23:55 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 2 Apr 2018 20:55:57 +0000 (23:55 +0300)
src/cargo/ops/cargo_rustc/context/compilation_files.rs
src/cargo/ops/cargo_rustc/context/mod.rs
src/cargo/ops/cargo_rustc/context/target_info.rs
src/cargo/ops/cargo_rustc/fingerprint.rs
src/cargo/ops/cargo_rustc/mod.rs

index b1cfa97c6f0eaed75dea01846d653549c63fce17..752b07cf6c6261118dc7c5e33a4a28d51885166a 100644 (file)
@@ -9,7 +9,7 @@ use lazycell::LazyCell;
 
 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};
 
@@ -35,7 +35,7 @@ pub struct CompilationFiles<'a, 'cfg: 'a> {
     ///  - 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> {
@@ -157,7 +157,7 @@ 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)
@@ -215,7 +215,7 @@ 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)>>> {
         let out_dir = self.out_dir(unit);
         let file_stem = self.file_stem(unit);
         let link_stem = self.link_stem(unit);
@@ -233,9 +233,9 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
                 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 {
@@ -277,7 +277,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
                                         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
@@ -294,19 +294,19 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> {
                     | 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
                                 },
                             )?;
                         }
index 36857b1a708a8e59b4a6934755b6f95c8be24256..5993c9225c676a109eaae84546d792a899aa080d 100644 (file)
@@ -28,7 +28,7 @@ use self::compilation_files::CompilationFiles;
 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.
@@ -277,7 +277,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
     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)
     }
 
index 1514ab28f0f49c752e8f679306a7f5c1a8aef3dc..6dbb3076bdfa8bad6d97f287cc87b4f901897a7b 100644 (file)
@@ -18,7 +18,7 @@ pub struct TargetInfo {
 
 /// 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)
@@ -30,7 +30,7 @@ pub enum TargetFileType {
 pub struct FileType {
     pub suffix: String,
     pub prefix: String,
-    pub target_file_type: TargetFileType,
+    pub flavor: FileFlavor,
     pub should_replace_hyphens: bool,
 }
 
@@ -126,7 +126,7 @@ impl TargetInfo {
     pub fn file_types(
         &self,
         crate_type: &str,
-        file_type: TargetFileType,
+        file_type: FileFlavor,
         kind: &TargetKind,
         target_triple: &str,
     ) -> CargoResult<Option<Vec<FileType>>> {
@@ -147,7 +147,7 @@ impl TargetInfo {
             FileType {
                 suffix: suffix.to_string(),
                 prefix: prefix.clone(),
-                target_file_type: file_type,
+                flavor: file_type,
                 should_replace_hyphens: false,
             },
         ];
@@ -159,7 +159,7 @@ impl TargetInfo {
             ret.push(FileType {
                 suffix: ".dll.lib".to_string(),
                 prefix: prefix.clone(),
-                target_file_type: TargetFileType::Normal,
+                flavor: FileFlavor::Normal,
                 should_replace_hyphens: false,
             })
         }
@@ -169,7 +169,7 @@ impl TargetInfo {
             ret.push(FileType {
                 suffix: ".wasm".to_string(),
                 prefix: prefix.clone(),
-                target_file_type: TargetFileType::Normal,
+                flavor: FileFlavor::Normal,
                 should_replace_hyphens: true,
             })
         }
@@ -184,14 +184,14 @@ impl TargetInfo {
                 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,
                 })
             }
index 74deda193d8bf9044486f879bd0cd3ac98f9cafd..0c55df23f2e726b783898eb662dd1a7698bed401 100644 (file)
@@ -16,7 +16,7 @@ use util::errors::{CargoResult, CargoResultExt};
 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.
@@ -92,7 +92,7 @@ pub fn prepare_target<'a, 'cfg>(
             .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();
index 0007ac15b4c0a0d2359def534d1a18eba3bd56be..76b9d9afd243fa044e0cdcd9d9603097551d81e7 100644 (file)
@@ -25,7 +25,7 @@ use self::job_queue::JobQueue;
 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;
 
@@ -194,7 +194,7 @@ pub fn compile_targets<'a, 'cfg: 'a>(
 
     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;
             }
 
@@ -1072,7 +1072,7 @@ fn build_deps_args<'a, 'cfg>(
         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();