]> git.tdb.fi Git - builder.git/blobdiff - source/dependencycache.cpp
Variables in Build files weren't such a hot idea. KISS.
[builder.git] / source / dependencycache.cpp
index 6e099ba51dd2ce9f89f9cfaf4e608f010e2fce6c..e91bdbc91da0e0e8f59c5ec3cf4b010b8b41a793 100644 (file)
@@ -21,6 +21,11 @@ void DependencyCache::set_deps(const string &tgt, const StringList &d)
        changed = true;
 }
 
+bool DependencyCache::has_deps(const string &tgt) const
+{
+       return deps.count(tgt);
+}
+
 const StringList &DependencyCache::get_deps(const string &tgt) const
 {
        return get_item(deps, tgt);
@@ -28,10 +33,12 @@ const StringList &DependencyCache::get_deps(const string &tgt) const
 
 void DependencyCache::save() const
 {
-       if(deps.empty() || !changed || package.get_builder().get_dry_run())
+       if(deps.empty() || !changed)
                return;
 
-       IO::BufferedFile out((package.get_source()/".deps").str(), IO::M_WRITE);
+       FS::Path fn = package.get_source()/".deps";
+       package.get_builder().get_logger().log("files", format("Writing %s", fn));
+       IO::BufferedFile out(fn.str(), IO::M_WRITE);
 
        for(DepsMap::const_iterator i=deps.begin(); i!=deps.end(); ++i)
        {
@@ -44,11 +51,12 @@ void DependencyCache::save() const
 
 void DependencyCache::load()
 {
-       string fn = (package.get_source()/".deps").str();
+       FS::Path fn = package.get_source()/".deps";
 
        if(FS::Stat st = FS::stat(fn))
        {
-               IO::BufferedFile in(fn);
+               package.get_builder().get_logger().log("files", format("Reading %s", fn));
+               IO::BufferedFile in(fn.str());
 
                string line;
                while(in.getline(line))