consider file existence for dirtiness
authorEvan Martin <martine@danga.com>
Sat, 23 Oct 2010 21:15:35 +0000 (14:15 -0700)
committerEvan Martin <martine@danga.com>
Sat, 23 Oct 2010 21:15:35 +0000 (14:15 -0700)
ninja.h
ninja_test.cc

diff --git a/ninja.h b/ninja.h
index 02bfd59..d7f4108 100644 (file)
--- a/ninja.h
+++ b/ninja.h
@@ -137,6 +137,8 @@ void Edge::RecomputeDirty(StatHelper* stat_helper) {
     if ((*i)->file_->StatIfNecessary(stat_helper)) {
       if (Edge* edge = (*i)->in_edge_)
         edge->RecomputeDirty(stat_helper);
+      else
+        (*i)->dirty_ = !(*i)->file_->exists();
     }
     if ((*i)->dirty_)
       dirty = true;
index cba3407..a00cfd9 100644 (file)
@@ -190,7 +190,13 @@ struct BuildTest : public StateTestWithBuiltinRules,
 };
 
 void BuildTest::Dirty(const string& path) {
-  GetNode(path)->MarkDirty();
+  Node* node = GetNode(path);
+  node->MarkDirty();
+
+  // If it's an input file, mark that we've already stat()ed it and
+  // it's missing.
+  if (!node->in_edge_)
+    node->file_->mtime_ = 0;
 }
 
 void BuildTest::Touch(const string& path) {