summaryrefslogtreecommitdiffstats
path: root/src/build.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2013-04-10 19:49:23 (GMT)
committerEvan Martin <martine@danga.com>2013-04-10 19:49:23 (GMT)
commit53339104c51139f7ed5f1265bae3062d157f5311 (patch)
tree8e40fa910c80d33e2dc3b17dacf5ca53c7a6b2bd /src/build.cc
parent808393fcf01d5211ab062acd3dea46ed8041f829 (diff)
downloadNinja-53339104c51139f7ed5f1265bae3062d157f5311.zip
Ninja-53339104c51139f7ed5f1265bae3062d157f5311.tar.gz
Ninja-53339104c51139f7ed5f1265bae3062d157f5311.tar.bz2
always use output timestamp for deps
Using the timestamp of the .d file was wrong. It can be written at a different time than the output, and it is immediately deleted after parsing; only the output remains for subsequent timestamp comparison purposes, so always use the output's timestamp. (This is how the code worked on Windows already.)
Diffstat (limited to 'src/build.cc')
-rw-r--r--src/build.cc17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/build.cc b/src/build.cc
index 39e3e2a..199749f 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -714,12 +714,10 @@ void Builder::FinishCommand(CommandRunner::Result* result) {
// can fail, which makes the command fail from a build perspective.
vector<Node*> deps_nodes;
- TimeStamp deps_mtime = 0;
string deps_type = edge->GetBinding("deps");
if (result->success() && !deps_type.empty()) {
string extract_err;
- if (!ExtractDeps(result, deps_type, &deps_nodes, &deps_mtime,
- &extract_err)) {
+ if (!ExtractDeps(result, deps_type, &deps_nodes, &extract_err)) {
if (!result->output.empty())
result->output.append("\n");
result->output.append(extract_err);
@@ -790,11 +788,7 @@ void Builder::FinishCommand(CommandRunner::Result* result) {
if (!deps_type.empty()) {
assert(edge->outputs_.size() == 1 && "should have been rejected by parser");
Node* out = edge->outputs_[0];
- if (!deps_mtime) {
- // On Windows there's no separate file to compare against; just reuse
- // the output's mtime.
- deps_mtime = disk_interface_->Stat(out->path());
- }
+ TimeStamp deps_mtime = disk_interface_->Stat(out->path());
scan_.deps_log()->RecordDeps(out, deps_mtime, deps_nodes);
}
@@ -803,7 +797,6 @@ void Builder::FinishCommand(CommandRunner::Result* result) {
bool Builder::ExtractDeps(CommandRunner::Result* result,
const string& deps_type,
vector<Node*>* deps_nodes,
- TimeStamp* deps_mtime,
string* err) {
#ifdef _WIN32
if (deps_type == "msvc") {
@@ -822,12 +815,6 @@ bool Builder::ExtractDeps(CommandRunner::Result* result,
return false;
}
- *deps_mtime = disk_interface_->Stat(depfile);
- if (*deps_mtime <= 0) {
- *err = string("unable to read depfile");
- return false;
- }
-
string content = disk_interface_->ReadFile(depfile, err);
if (!err->empty())
return false;