summaryrefslogtreecommitdiffstats
path: root/src/build_log.h
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2011-09-19 01:56:15 (GMT)
committerPeter Collingbourne <peter@pcc.me.uk>2011-10-24 00:16:38 (GMT)
commit0efbbbf67a94452919084765e87106e7748274cb (patch)
tree21c8c5a13b70d7f287b2f569a35f6a03a7f1c19d /src/build_log.h
parent386cbf6c7e49c88b87f54619b06670ea9f66c8a5 (diff)
downloadNinja-0efbbbf67a94452919084765e87106e7748274cb.zip
Ninja-0efbbbf67a94452919084765e87106e7748274cb.tar.gz
Ninja-0efbbbf67a94452919084765e87106e7748274cb.tar.bz2
Implement restat rules
A restat rule is a rule which is capable of pruning the build tree depending on the timestamps of its outputs before and after a build. After a restat rule is rebuilt, Ninja will re-stat each output file to obtain its current timestamp. If the timestamp is unchanged from when Ninja initially stat'ed the file before starting the build, Ninja will mark that output file as clean, and recursively for each reverse dependency of the output file, recompute its dirty status. Ninja then stores the most recent timestamp of any input file in the build log entry associated with the output file. This timestamp will be treated by future invocations of Ninja as the output file's modification time instead of the output file's actual modification time for the purpose of deciding whether it is dirty (but not whether its reverse dependencies are dirty).
Diffstat (limited to 'src/build_log.h')
-rw-r--r--src/build_log.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/build_log.h b/src/build_log.h
index 4a11c1a..99ae5a0 100644
--- a/src/build_log.h
+++ b/src/build_log.h
@@ -38,7 +38,8 @@ struct BuildLog {
void SetConfig(BuildConfig* config) { config_ = config; }
bool OpenForWrite(const string& path, string* err);
- void RecordCommand(Edge* edge, int start_time, int end_time);
+ void RecordCommand(Edge* edge, int start_time, int end_time,
+ time_t restat_mtime = 0);
void Close();
/// Load the on-disk log.
@@ -49,11 +50,13 @@ struct BuildLog {
string command;
int start_time;
int end_time;
+ time_t restat_mtime;
// Used by tests.
bool operator==(const LogEntry& o) {
return output == o.output && command == o.command &&
- start_time == o.start_time && end_time == o.end_time;
+ start_time == o.start_time && end_time == o.end_time &&
+ restat_mtime == o.restat_mtime;
}
};