rebuild when command lines change
authorEvan Martin <martine@danga.com>
Fri, 7 Jan 2011 22:00:21 +0000 (14:00 -0800)
committerEvan Martin <martine@danga.com>
Fri, 7 Jan 2011 22:00:21 +0000 (14:00 -0800)
src/ninja_jumble.cc

index 66cfd6a..dc41f2e 100644 (file)
@@ -151,6 +151,8 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
     }
   }
 
+  string command = EvaluateCommand();
+
   assert(!outputs_.empty());
   for (vector<Node*>::iterator i = outputs_.begin(); i != outputs_.end(); ++i) {
     // We may have other outputs, that our input-recursive traversal hasn't hit
@@ -162,6 +164,14 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
     if (dirty || !(*i)->file_->exists() ||
         (*i)->file_->mtime_ < most_recent_input) {
       (*i)->dirty_ = true;
+    } else {
+      // May also be dirty due to the command changing since the last build.
+      BuildLog::LogEntry* entry;
+      if (state->build_log_ &&
+          (entry = state->build_log_->LookupByOutput((*i)->file_->path_))) {
+        if (command != entry->command)
+          (*i)->dirty_ = true;
+      }
     }
   }
   return true;