diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-01-16 22:10:52 (GMT) |
---|---|---|
committer | Jan Niklas Hasse <jhasse@bixense.com> | 2020-01-16 22:10:52 (GMT) |
commit | d47e1eb00d2eac4a3b864639ab972a53e60f4925 (patch) | |
tree | 90aada012686ab9f16128ea55c238ce6ecfae4d2 /src/build_log.cc | |
parent | 26fc40c59a5630bf1429f8df90bb9352c7b593a0 (diff) | |
download | Ninja-d47e1eb00d2eac4a3b864639ab972a53e60f4925.zip Ninja-d47e1eb00d2eac4a3b864639ab972a53e60f4925.tar.gz Ninja-d47e1eb00d2eac4a3b864639ab972a53e60f4925.tar.bz2 |
restat: Accept list of outputs to restat (none means all)
This will become handy when the generator only wants to restat the
build.ninja entry in the log. See #1718.
Diffstat (limited to 'src/build_log.cc')
-rw-r--r-- | src/build_log.cc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/build_log.cc b/src/build_log.cc index e2a9344..98543b6 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -422,6 +422,7 @@ bool BuildLog::Recompact(const string& path, const BuildLogUser& user, bool BuildLog::Restat(const StringPiece path, const DiskInterface& disk_interface, + const int output_count, char** outputs, std::string* const err) { METRIC_RECORD(".ninja_log restat"); @@ -439,12 +440,21 @@ bool BuildLog::Restat(const StringPiece path, return false; } for (Entries::iterator i = entries_.begin(); i != entries_.end(); ++i) { - const TimeStamp mtime = disk_interface.Stat(i->second->output, err); - if (mtime == -1) { - fclose(f); - return false; + bool skip = output_count > 0; + for (int j = 0; j < output_count; ++j) { + if (i->second->output == outputs[j]) { + skip = false; + break; + } + } + if (!skip) { + const TimeStamp mtime = disk_interface.Stat(i->second->output, err); + if (mtime == -1) { + fclose(f); + return false; + } + i->second->mtime = mtime; } - i->second->mtime = mtime; if (!WriteEntry(f, *i->second)) { *err = strerror(errno); |