cargo-compile delegates to cargo-rustc
authorCarlhuda <carlhuda@tilde.io>
Fri, 2 May 2014 01:14:24 +0000 (18:14 -0700)
committerCarlhuda <carlhuda@tilde.io>
Fri, 2 May 2014 01:14:24 +0000 (18:14 -0700)
libs/hamcrest-rust
src/cargo/core/resolver.rs
src/cargo/mod.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_rustc.rs
src/cargo/util/process_builder.rs

index de700414aab1aaa4461618ce7a516cb24a8e6665..add50d98e97ef30e7264ae70b83cf5ddedbf4450 160000 (submodule)
@@ -1 +1 @@
-Subproject commit de700414aab1aaa4461618ce7a516cb24a8e6665
+Subproject commit add50d98e97ef30e7264ae70b83cf5ddedbf4450
index c52c11af1516884f13c4d7ef8bbd9625450cfa38..1f5386716021ffe066cd1473c6338cb6399a0731 100644 (file)
@@ -19,7 +19,7 @@ pub fn resolve(deps: &[core::Dependency], registry: &core::Registry) -> CargoRes
 
         let opts = registry.query(curr.get_name());
 
-        assert!(!resolve.contains_key_equiv(&curr.get_name()), "already traversed {}", curr.get_name());
+        //assert!(!resolve.contains_key_equiv(&curr.get_name()), "already traversed {}", curr.get_name());
         // Temporary, but we must have exactly one option to satisfy the dep
         assert!(opts.len() == 1, "invalid num of results {}", opts.len());
 
index a4e8bfcc0ecb89e3a52e16b88984a74c30bb4468..3dc7e22be4fcbc45d345ae47bf29986682a1ac5f 100644 (file)
@@ -93,8 +93,8 @@ impl<T> ToCargoError<T, Option<T>> for Option<T> {
 trait RepresentsFlags : FlagConfig + Decodable<FlagDecoder, HammerError> {}
 impl<T: FlagConfig + Decodable<FlagDecoder, HammerError>> RepresentsFlags for T {}
 
-trait RepresentsJSON : Decodable<json::Decoder, json::Error> {}
-impl <T: Decodable<json::Decoder, json::Error>> RepresentsJSON for T {}
+trait RepresentsJSON : Decodable<json::Decoder, json::DecoderError> {}
+impl <T: Decodable<json::Decoder, json::DecoderError>> RepresentsJSON for T {}
 
 #[deriving(Decodable)]
 pub struct NoFlags;
@@ -151,5 +151,5 @@ fn json_from_stdin<T: RepresentsJSON>() -> CargoResult<T> {
     let json = try!(json::from_str(input).to_cargo_error(format!("Cannot parse json: {}", input), 1));
     let mut decoder = json::Decoder::new(json);
 
-    Decodable::decode(&mut decoder).to_cargo_error(|e: json::Error| format!("{}", e), 1)
+    Decodable::decode(&mut decoder).to_cargo_error(|e: json::DecoderError| format!("{}", e), 1)
 }
index 0ad7eeeeb9858858c6e54f7c023c57b5e9c7d9f1..925800d1affbdf29e26f97faaaa01ae21416f454 100644 (file)
@@ -31,6 +31,7 @@ use core::Package;
 use core::source::Source;
 use core::dependency::Dependency;
 use sources::path::PathSource;
+use ops::cargo_rustc;
 use {CargoError,ToCargoError,CargoResult};
 
 #[deriving(Decodable)]
@@ -65,7 +66,9 @@ pub fn compile() -> CargoResult<()> {
     let packages = try!(source.get(names.as_slice()));
     let registry = PackageSet::new(packages.as_slice());
 
-    let resolved = resolve(deps.as_slice(), &registry);
+    let resolved = try!(resolve(deps.as_slice(), &registry));
+
+    cargo_rustc::compile(&resolved);
 
     Ok(())
     //call_rustc(~BufReader::new(manifest_bytes.as_slice()))
index 3cea643e04f73cc83f8a49947fde511e75264fff..39c410efae1356c830b8733a2f5a5e64d0a75864 100644 (file)
@@ -12,7 +12,7 @@ type Args = Vec<~str>;
 pub fn compile(pkgs: &core::PackageSet) {
     let sorted = match pkgs.sort() {
         Some(pkgs) => pkgs,
-        None => return
+        None => fail!("Could not perform topsort on PackageSet")
     };
 
     for pkg in sorted.iter() {
@@ -23,7 +23,7 @@ pub fn compile(pkgs: &core::PackageSet) {
 
 fn compile_pkg(pkg: &core::Package, pkgs: &core::PackageSet) {
     // Build up the destination
-    let src = pkg.get_root().join(Path::new(pkg.get_source().name.as_slice()));
+    let src = pkg.get_root().join(Path::new(pkg.get_source().path.as_slice()));
     let target = pkg.get_root().join(Path::new(pkg.get_target()));
 
     // First ensure that the directory exists
index 8d8958bfc561bec644ff5a8c6d89962e6776bca0..c1c1348a3bf0ba12149b76c4df7e3dc0caa391de 100644 (file)
@@ -1,7 +1,7 @@
 use std::os;
 use std::path::Path;
 use std::io;
-use std::io::process::{Process,ProcessConfig,ProcessOutput};
+use std::io::process::{Process,ProcessConfig,ProcessOutput,InheritFd};
 use ToCargoError;
 use CargoResult;
 
@@ -33,12 +33,15 @@ impl ProcessBuilder {
     self
   }
 
+  // TODO: clean all this up
   pub fn exec(&self) -> io::IoResult<()> {
       let mut config = ProcessConfig::new();
 
       config.program = self.program.as_slice();
       config.args = self.args.as_slice();
       config.cwd = Some(&self.cwd);
+      config.stdout = InheritFd(1);
+      config.stderr = InheritFd(2);
 
       let mut process = try!(Process::configure(config));
       let exit = process.wait();