Move syslog to BuildContext

This commit is contained in:
Niels langager Ellegaard 2014-01-05 10:24:08 +01:00
parent 177f740311
commit e1c59828b4
4 changed files with 20 additions and 32 deletions

View File

@ -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
}
}

View File

@ -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] {

View File

@ -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())

View File

@ -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
}
}