]> git.proxmox.com Git - cargo.git/commitdiff
Fill `ops::registry::transmit` with the right value
authorPierre Krieger <pierre.krieger1708@gmail.com>
Tue, 28 Oct 2014 08:30:57 +0000 (09:30 +0100)
committerPierre Krieger <pierre.krieger1708@gmail.com>
Tue, 28 Oct 2014 08:30:57 +0000 (09:30 +0100)
src/cargo/core/dependency.rs
src/cargo/ops/registry.rs

index ad814d6e42e2b2d84c3e071cd2167fa052beee66..fe83cf7160c5e67ab301e4d7119c63b44a063f8b 100644 (file)
@@ -151,6 +151,12 @@ impl Dependency {
                                       &self.source_id == id.get_source_id()))
     }
 
+    /// If none, this dependencies must be built for all platforms.
+    /// If some, it must only be built for the specified platform.
+    pub fn get_only_for_platform(&self) -> Option<&str> {
+        self.only_for_platform.as_ref().map(|s| s.as_slice())
+    }
+
     /// Returns true if the dependency should be built for this platform.
     pub fn is_active_for_platform(&self, platform: &str) -> bool {
         match self.only_for_platform {
index fbef2c6291726b81cbaf0a5d034d514001206dbc..9ffef7581c37528ab07e98bc0df81c56ea8a153e 100644 (file)
@@ -72,7 +72,7 @@ fn transmit(pkg: &Package, tarball: &Path, registry: &mut Registry)
             name: dep.get_name().to_string(),
             features: dep.get_features().to_vec(),
             version_req: dep.get_version_req().to_string(),
-            target: None, // FIXME: fill this out
+            target: dep.get_only_for_platform().map(|s| s.to_string()),
         }
     }).collect::<Vec<NewCrateDependency>>();
     let manifest = pkg.get_manifest();