diff options
author | Evan Martin <martine@danga.com> | 2013-01-15 02:00:52 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2013-04-08 22:02:08 (GMT) |
commit | c3c1b3fda8b415e917b2762526c0c86e099b4300 (patch) | |
tree | aabdf6eee5d92d9c307c5bad67c380d90244f3c1 | |
parent | e223be80b6d308d64674ec884df461fe5b8e42e6 (diff) | |
download | Ninja-c3c1b3fda8b415e917b2762526c0c86e099b4300.zip Ninja-c3c1b3fda8b415e917b2762526c0c86e099b4300.tar.gz Ninja-c3c1b3fda8b415e917b2762526c0c86e099b4300.tar.bz2 |
remove depfiles files as they're parsed
-rw-r--r-- | src/build.cc | 8 | ||||
-rw-r--r-- | src/build_test.cc | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/build.cc b/src/build.cc index f648584..0d819b2 100644 --- a/src/build.cc +++ b/src/build.cc @@ -879,6 +879,8 @@ bool Builder::ExtractDeps(CommandRunner::Result* result, string content = disk_interface_->ReadFile(depfile, err); if (!err->empty()) return false; + if (content.empty()) + return true; DepfileParser deps; if (!deps.Parse(&content, err)) @@ -893,12 +895,10 @@ bool Builder::ExtractDeps(CommandRunner::Result* result, deps_nodes->push_back(state_->GetNode(*i)); } - /* TODO: unlink the file via diskinterface. - if (unlink(depfile.c_str()) < 0) { - *err = string("unlink: ")) + strerror(errno); + if (disk_interface_->RemoveFile(depfile) < 0) { + *err = string("deleting depfile: ") + strerror(errno); return false; } - */ #endif return true; diff --git a/src/build_test.cc b/src/build_test.cc index 3617439..bcd4d2e 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -762,6 +762,9 @@ TEST_F(BuildTest, OrderOnlyDeps) { fs_.Tick(); + // Recreate the depfile, as it should have been deleted by the build. + fs_.Create("foo.o.d", "foo.o: blah.h bar.h\n"); + // implicit dep dirty, expect a rebuild. fs_.Create("blah.h", ""); fs_.Create("bar.h", ""); @@ -774,6 +777,9 @@ TEST_F(BuildTest, OrderOnlyDeps) { fs_.Tick(); + // Recreate the depfile, as it should have been deleted by the build. + fs_.Create("foo.o.d", "foo.o: blah.h bar.h\n"); + // order only dep dirty, no rebuild. fs_.Create("otherfile", ""); command_runner_.commands_ran_.clear(); |