diff options
author | Evan Martin <martine@danga.com> | 2010-10-23 21:15:35 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2010-10-23 21:15:35 (GMT) |
commit | 4dda793603766e549c2b3e586cb9e76485493798 (patch) | |
tree | 777ce882692ed4acbd417e3c4f4d29f215cf155c | |
parent | bade0e3035d0b8e2f5c2cb37eac62dc0a30e675a (diff) | |
download | Ninja-4dda793603766e549c2b3e586cb9e76485493798.zip Ninja-4dda793603766e549c2b3e586cb9e76485493798.tar.gz Ninja-4dda793603766e549c2b3e586cb9e76485493798.tar.bz2 |
consider file existence for dirtiness
-rw-r--r-- | ninja.h | 2 | ||||
-rw-r--r-- | ninja_test.cc | 8 |
2 files changed, 9 insertions, 1 deletions
@@ -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; diff --git a/ninja_test.cc b/ninja_test.cc index cba3407..a00cfd9 100644 --- a/ninja_test.cc +++ b/ninja_test.cc @@ -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) { |