From: Evan Martin Date: Sat, 23 Oct 2010 21:15:35 +0000 (-0700) Subject: consider file existence for dirtiness X-Git-Tag: release-120715~730 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4dda793603766e549c2b3e586cb9e76485493798;p=platform%2Fupstream%2Fninja.git consider file existence for dirtiness --- diff --git a/ninja.h b/ninja.h index 02bfd59..d7f4108 100644 --- 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; 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) {