Skip to content

Commit e1c5982

Browse files
committed
Move syslog to BuildContext
1 parent 177f740 commit e1c5982

File tree

4 files changed

+20
-32
lines changed

4 files changed

+20
-32
lines changed

src/librustpkg/api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ pub fn new_default_context(c: workcache::Context, p: Path) -> BuildContext {
4949
cfgs: ~[],
5050
rustc_flags: RustcFlags::default(),
5151
use_rust_path_hack: false,
52-
sysroot: p
5352
},
53+
sysroot: p,
5454
workcache_context: c
5555
}
5656
}

src/librustpkg/context.rs

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,35 @@ pub struct Context {
2626
// FOO/src/bar-0.1 instead of FOO). The flag doesn't affect where
2727
// rustpkg stores build artifacts.
2828
use_rust_path_hack: bool,
29-
// The root directory containing the Rust standard libraries
30-
sysroot: Path
3129
}
3230

3331
#[deriving(Clone)]
3432
pub struct BuildContext {
3533
// Context for workcache
3634
workcache_context: workcache::Context,
37-
// Everything else
38-
context: Context
35+
// Parsed command line options
36+
context: Context,
37+
// The root directory containing the Rust standard libraries
38+
sysroot: Path
3939
}
4040

4141
impl BuildContext {
4242
pub fn sysroot(&self) -> Path {
43-
self.context.sysroot.clone()
43+
self.sysroot.clone()
4444
}
4545

46+
// Hack so that rustpkg can run either out of a rustc target dir,
47+
// or the host dir
4648
pub fn sysroot_to_use(&self) -> Path {
47-
self.context.sysroot_to_use()
49+
if !in_target(&self.sysroot) {
50+
self.sysroot.clone()
51+
} else {
52+
let mut p = self.sysroot.clone();
53+
p.pop();
54+
p.pop();
55+
p.pop();
56+
p
57+
}
4858
}
4959

5060
/// Returns the flags to pass to rustc, as a vector of strings
@@ -131,28 +141,6 @@ pub enum StopBefore {
131141
}
132142

133143
impl Context {
134-
pub fn sysroot(&self) -> Path {
135-
self.sysroot.clone()
136-
}
137-
138-
/// Debugging
139-
pub fn sysroot_str(&self) -> ~str {
140-
self.sysroot.as_str().unwrap().to_owned()
141-
}
142-
143-
// Hack so that rustpkg can run either out of a rustc target dir,
144-
// or the host dir
145-
pub fn sysroot_to_use(&self) -> Path {
146-
if !in_target(&self.sysroot) {
147-
self.sysroot.clone()
148-
} else {
149-
let mut p = self.sysroot.clone();
150-
p.pop();
151-
p.pop();
152-
p.pop();
153-
p
154-
}
155-
}
156144

157145
/// Returns the flags to pass to rustc, as a vector of strings
158146
pub fn flag_strs(&self) -> ~[~str] {

src/librustpkg/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,8 +913,8 @@ pub fn main_args(args: &[~str]) -> int {
913913
cfgs: cfgs.clone(),
914914
rustc_flags: rustc_flags.clone(),
915915
use_rust_path_hack: use_rust_path_hack,
916-
sysroot: sroot.clone(), // Currently, only tests override this
917916
},
917+
sysroot: sroot.clone(), // Currently, only tests override this
918918
workcache_context: api::default_context(sroot.clone(),
919919
default_workspace()).workcache_context
920920
}.run(command, rm_args.clone())

src/librustpkg/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext {
5454
rustc_flags: RustcFlags::default(),
5555

5656
use_rust_path_hack: false,
57-
sysroot: sysroot
58-
}
57+
},
58+
sysroot: sysroot
5959
}
6060
}
6161

0 commit comments

Comments
 (0)