}
}
-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
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
}
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
}
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| {
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::*
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,
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;
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,