]> git.tdb.fi Git - builder.git/blobdiff - source/dependencycache.cpp
Re-stat FileTargets after a successful build
[builder.git] / source / dependencycache.cpp
index 6e099ba51dd2ce9f89f9cfaf4e608f010e2fce6c..a4211a3193066bc3049921026c60df2877c2f2c4 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_directory()/".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_directory()/".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))