about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiels langager Ellegaard <niels.ellegaard@gmail.com>2014-01-05 10:24:08 +0100
committerNiels langager Ellegaard <niels.ellegaard@gmail.com>2014-01-05 11:25:12 +0100
commite1c59828b4fd1f2049b9ec21d657c2adda2fe55d (patch)
tree263319aa6d186016737ee38d1755e9ece313c962
parent177f740311639165fb1464688752c01a039fa577 (diff)
downloadrust-e1c59828b4fd1f2049b9ec21d657c2adda2fe55d.tar.gz
rust-e1c59828b4fd1f2049b9ec21d657c2adda2fe55d.zip
Move syslog to BuildContext
-rw-r--r--src/librustpkg/api.rs2
-rw-r--r--src/librustpkg/context.rs44
-rw-r--r--src/librustpkg/lib.rs2
-rw-r--r--src/librustpkg/tests.rs4
4 files changed, 20 insertions, 32 deletions
diff --git a/src/librustpkg/api.rs b/src/librustpkg/api.rs
index 0730a6fc3a2..45c37a93e3e 100644
--- a/src/librustpkg/api.rs
+++ b/src/librustpkg/api.rs
@@ -49,8 +49,8 @@ pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext {
             cfgs: ~[],
             rustc_flags: RustcFlags::default(),
             use_rust_path_hack: false,
-            sysroot: p
         },
+        sysroot: p,
         workcache_context: c
     }
 }
diff --git a/src/librustpkg/context.rs b/src/librustpkg/context.rs
index 3fb6f9caeb8..fddfa02032c 100644
--- a/src/librustpkg/context.rs
+++ b/src/librustpkg/context.rs
@@ -26,25 +26,35 @@ pub struct Context {
     // FOO/src/bar-0.1 instead of FOO). The flag doesn't affect where
     // rustpkg stores build artifacts.
     use_rust_path_hack: bool,
-    // The root directory containing the Rust standard libraries
-    sysroot: Path
 }
 
 #[deriving(Clone)]
 pub struct BuildContext {
     // Context for workcache
     workcache_context: workcache::Context,
-    // Everything else
-    context: Context
+    // Parsed command line options
+    context: Context,
+    // The root directory containing the Rust standard libraries
+    sysroot: Path
 }
 
 impl BuildContext {
     pub fn sysroot(&self) -> Path {
-        self.context.sysroot.clone()
+        self.sysroot.clone()
     }
 
+    // Hack so that rustpkg can run either out of a rustc target dir,
+    // or the host dir
     pub fn sysroot_to_use(&self) -> Path {
-        self.context.sysroot_to_use()
+        if !in_target(&self.sysroot) {
+            self.sysroot.clone()
+        } else {
+            let mut p = self.sysroot.clone();
+            p.pop();
+            p.pop();
+            p.pop();
+            p
+        }
     }
 
     /// Returns the flags to pass to rustc, as a vector of strings
@@ -131,28 +141,6 @@ pub enum StopBefore {
 }
 
 impl Context {
-    pub fn sysroot(&self) -> Path {
-        self.sysroot.clone()
-    }
-
-    /// Debugging
-    pub fn sysroot_str(&self) -> ~str {
-        self.sysroot.as_str().unwrap().to_owned()
-    }
-
-    // Hack so that rustpkg can run either out of a rustc target dir,
-    // or the host dir
-    pub fn sysroot_to_use(&self) -> Path {
-        if !in_target(&self.sysroot) {
-            self.sysroot.clone()
-        } else {
-            let mut p = self.sysroot.clone();
-            p.pop();
-            p.pop();
-            p.pop();
-            p
-        }
-    }
 
     /// Returns the flags to pass to rustc, as a vector of strings
     pub fn flag_strs(&self) -> ~[~str] {
diff --git a/src/librustpkg/lib.rs b/src/librustpkg/lib.rs
index 43f190f37a2..39bc4c7570e 100644
--- a/src/librustpkg/lib.rs
+++ b/src/librustpkg/lib.rs
@@ -913,8 +913,8 @@ pub fn main_args(args: &[~str]) -> int {
                 cfgs: cfgs.clone(),
                 rustc_flags: rustc_flags.clone(),
                 use_rust_path_hack: use_rust_path_hack,
-                sysroot: sroot.clone(), // Currently, only tests override this
             },
+            sysroot: sroot.clone(), // Currently, only tests override this
             workcache_context: api::default_context(sroot.clone(),
                                                     default_workspace()).workcache_context
         }.run(command, rm_args.clone())
diff --git a/src/librustpkg/tests.rs b/src/librustpkg/tests.rs
index 2ceed4f3df7..aa6dab05add 100644
--- a/src/librustpkg/tests.rs
+++ b/src/librustpkg/tests.rs
@@ -54,8 +54,8 @@ fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext {
             rustc_flags: RustcFlags::default(),
 
             use_rust_path_hack: false,
-            sysroot: sysroot
-        }
+        },
+        sysroot: sysroot
     }
 }