Skip to content

Commit e19b1b1

Browse files
committed
auto merge of #11468 : klutzy/rust/workcache-cleanup, r=alexcrichton
2 parents 01794cc + d578ecc commit e19b1b1

File tree

3 files changed

+9
-36
lines changed

3 files changed

+9
-36
lines changed

src/libextra/workcache.rs

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -209,28 +209,11 @@ impl Drop for Database {
209209
}
210210
}
211211

212-
pub struct Logger {
213-
// FIXME #4432: Fill in
214-
priv a: ()
215-
}
216-
217-
impl Logger {
218-
219-
pub fn new() -> Logger {
220-
Logger { a: () }
221-
}
222-
223-
pub fn info(&self, i: &str) {
224-
info!("workcache: {}", i);
225-
}
226-
}
227-
228212
pub type FreshnessMap = TreeMap<~str,extern fn(&str,&str)->bool>;
229213

230214
#[deriving(Clone)]
231215
pub struct Context {
232216
db: RWArc<Database>,
233-
priv logger: RWArc<Logger>,
234217
priv cfg: Arc<json::Object>,
235218
/// Map from kinds (source, exe, url, etc.) to a freshness function.
236219
/// The freshness function takes a name (e.g. file path) and value
@@ -275,18 +258,15 @@ fn json_decode<T:Decodable<json::Decoder>>(s: &str) -> T {
275258
impl Context {
276259

277260
pub fn new(db: RWArc<Database>,
278-
lg: RWArc<Logger>,
279261
cfg: Arc<json::Object>) -> Context {
280-
Context::new_with_freshness(db, lg, cfg, Arc::new(TreeMap::new()))
262+
Context::new_with_freshness(db, cfg, Arc::new(TreeMap::new()))
281263
}
282264

283265
pub fn new_with_freshness(db: RWArc<Database>,
284-
lg: RWArc<Logger>,
285266
cfg: Arc<json::Object>,
286267
freshness: Arc<FreshnessMap>) -> Context {
287268
Context {
288269
db: db,
289-
logger: lg,
290270
cfg: cfg,
291271
freshness: freshness
292272
}
@@ -378,15 +358,11 @@ impl<'a> Prep<'a> {
378358
None => fail!("missing freshness-function for '{}'", kind),
379359
Some(f) => (*f)(name, val)
380360
};
381-
self.ctxt.logger.write(|lg| {
382-
if fresh {
383-
lg.info(format!("{} {}:{} is fresh",
384-
cat, kind, name));
385-
} else {
386-
lg.info(format!("{} {}:{} is not fresh",
387-
cat, kind, name))
388-
}
389-
});
361+
if fresh {
362+
info!("{} {}:{} is fresh", cat, kind, name);
363+
} else {
364+
info!("{} {}:{} is not fresh", cat, kind, name);
365+
}
390366
fresh
391367
}
392368

@@ -509,7 +485,6 @@ fn test() {
509485
let db_path = make_path(~"db.json");
510486

511487
let cx = Context::new(RWArc::new(Database::new(db_path)),
512-
RWArc::new(Logger::new()),
513488
Arc::new(TreeMap::new()));
514489

515490
let s = cx.with_prep("test1", |prep| {

src/librustpkg/api.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub use source_control::{safe_git_clone, git_clone_url};
2525
use std::run;
2626
use extra::arc::{Arc,RWArc};
2727
use extra::workcache;
28-
use extra::workcache::{Database, Logger, FreshnessMap};
28+
use extra::workcache::{Database, FreshnessMap};
2929
use extra::treemap::TreeMap;
3030

3131
// A little sad -- duplicated from rustc::back::*
@@ -70,14 +70,13 @@ pub fn new_workcache_context(p: &Path) -> workcache::Context {
7070
let db_file = p.join("rustpkg_db.json"); // ??? probably wrong
7171
debug!("Workcache database file: {}", db_file.display());
7272
let db = RWArc::new(Database::new(db_file));
73-
let lg = RWArc::new(Logger::new());
7473
let cfg = Arc::new(TreeMap::new());
7574
let mut freshness: FreshnessMap = TreeMap::new();
7675
// Set up freshness functions for every type of dependency rustpkg
7776
// knows about
7877
freshness.insert(~"file", file_is_fresh);
7978
freshness.insert(~"binary", binary_is_fresh);
80-
workcache::Context::new_with_freshness(db, lg, cfg, Arc::new(freshness))
79+
workcache::Context::new_with_freshness(db, cfg, Arc::new(freshness))
8180
}
8281

8382
pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version,

src/librustpkg/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use extra::arc::Arc;
2020
use extra::arc::RWArc;
2121
use extra::tempfile::TempDir;
2222
use extra::workcache;
23-
use extra::workcache::{Database, Logger};
23+
use extra::workcache::{Database};
2424
use extra::treemap::TreeMap;
2525
use extra::getopts::groups::getopts;
2626
use std::run::ProcessOutput;
@@ -46,7 +46,6 @@ use exit_codes::{BAD_FLAG_CODE, COPY_FAILED_CODE};
4646
fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext {
4747
let context = workcache::Context::new(
4848
RWArc::new(Database::new(workspace.join("rustpkg_db.json"))),
49-
RWArc::new(Logger::new()),
5049
Arc::new(TreeMap::new()));
5150
BuildContext {
5251
workcache_context: context,

0 commit comments

Comments
 (0)