mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
extra::workcache: Remove unused Logger
This commit is contained in:
parent
a34727f276
commit
d578ecc407
@ -209,28 +209,11 @@ impl Drop for Database {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Logger {
|
||||
// FIXME #4432: Fill in
|
||||
priv a: ()
|
||||
}
|
||||
|
||||
impl Logger {
|
||||
|
||||
pub fn new() -> Logger {
|
||||
Logger { a: () }
|
||||
}
|
||||
|
||||
pub fn info(&self, i: &str) {
|
||||
info!("workcache: {}", i);
|
||||
}
|
||||
}
|
||||
|
||||
pub type FreshnessMap = TreeMap<~str,extern fn(&str,&str)->bool>;
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub struct Context {
|
||||
db: RWArc<Database>,
|
||||
priv logger: RWArc<Logger>,
|
||||
priv cfg: Arc<json::Object>,
|
||||
/// Map from kinds (source, exe, url, etc.) to a freshness function.
|
||||
/// 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 {
|
||||
impl Context {
|
||||
|
||||
pub fn new(db: RWArc<Database>,
|
||||
lg: RWArc<Logger>,
|
||||
cfg: Arc<json::Object>) -> Context {
|
||||
Context::new_with_freshness(db, lg, cfg, Arc::new(TreeMap::new()))
|
||||
Context::new_with_freshness(db, cfg, Arc::new(TreeMap::new()))
|
||||
}
|
||||
|
||||
pub fn new_with_freshness(db: RWArc<Database>,
|
||||
lg: RWArc<Logger>,
|
||||
cfg: Arc<json::Object>,
|
||||
freshness: Arc<FreshnessMap>) -> Context {
|
||||
Context {
|
||||
db: db,
|
||||
logger: lg,
|
||||
cfg: cfg,
|
||||
freshness: freshness
|
||||
}
|
||||
@ -378,15 +358,11 @@ impl<'a> Prep<'a> {
|
||||
None => fail!("missing freshness-function for '{}'", kind),
|
||||
Some(f) => (*f)(name, val)
|
||||
};
|
||||
self.ctxt.logger.write(|lg| {
|
||||
if fresh {
|
||||
lg.info(format!("{} {}:{} is fresh",
|
||||
cat, kind, name));
|
||||
} else {
|
||||
lg.info(format!("{} {}:{} is not fresh",
|
||||
cat, kind, name))
|
||||
}
|
||||
});
|
||||
if fresh {
|
||||
info!("{} {}:{} is fresh", cat, kind, name);
|
||||
} else {
|
||||
info!("{} {}:{} is not fresh", cat, kind, name);
|
||||
}
|
||||
fresh
|
||||
}
|
||||
|
||||
@ -509,7 +485,6 @@ fn test() {
|
||||
let db_path = make_path(~"db.json");
|
||||
|
||||
let cx = Context::new(RWArc::new(Database::new(db_path)),
|
||||
RWArc::new(Logger::new()),
|
||||
Arc::new(TreeMap::new()));
|
||||
|
||||
let s = cx.with_prep("test1", |prep| {
|
||||
|
@ -25,7 +25,7 @@ pub use source_control::{safe_git_clone, git_clone_url};
|
||||
use std::run;
|
||||
use extra::arc::{Arc,RWArc};
|
||||
use extra::workcache;
|
||||
use extra::workcache::{Database, Logger, FreshnessMap};
|
||||
use extra::workcache::{Database, FreshnessMap};
|
||||
use extra::treemap::TreeMap;
|
||||
|
||||
// A little sad -- duplicated from rustc::back::*
|
||||
@ -70,14 +70,13 @@ pub fn new_workcache_context(p: &Path) -> workcache::Context {
|
||||
let db_file = p.join("rustpkg_db.json"); // ??? probably wrong
|
||||
debug!("Workcache database file: {}", db_file.display());
|
||||
let db = RWArc::new(Database::new(db_file));
|
||||
let lg = RWArc::new(Logger::new());
|
||||
let cfg = Arc::new(TreeMap::new());
|
||||
let mut freshness: FreshnessMap = TreeMap::new();
|
||||
// Set up freshness functions for every type of dependency rustpkg
|
||||
// knows about
|
||||
freshness.insert(~"file", file_is_fresh);
|
||||
freshness.insert(~"binary", binary_is_fresh);
|
||||
workcache::Context::new_with_freshness(db, lg, cfg, Arc::new(freshness))
|
||||
workcache::Context::new_with_freshness(db, cfg, Arc::new(freshness))
|
||||
}
|
||||
|
||||
pub fn build_lib(sysroot: Path, root: Path, name: ~str, version: Version,
|
||||
|
@ -20,7 +20,7 @@ use extra::arc::Arc;
|
||||
use extra::arc::RWArc;
|
||||
use extra::tempfile::TempDir;
|
||||
use extra::workcache;
|
||||
use extra::workcache::{Database, Logger};
|
||||
use extra::workcache::{Database};
|
||||
use extra::treemap::TreeMap;
|
||||
use extra::getopts::groups::getopts;
|
||||
use std::run::ProcessOutput;
|
||||
@ -46,7 +46,6 @@ use exit_codes::{BAD_FLAG_CODE, COPY_FAILED_CODE};
|
||||
fn fake_ctxt(sysroot: Path, workspace: &Path) -> BuildContext {
|
||||
let context = workcache::Context::new(
|
||||
RWArc::new(Database::new(workspace.join("rustpkg_db.json"))),
|
||||
RWArc::new(Logger::new()),
|
||||
Arc::new(TreeMap::new()));
|
||||
BuildContext {
|
||||
workcache_context: context,
|
||||
|
Loading…
Reference in New Issue
Block a user