summaryrefslogtreecommitdiffstats
path: root/src/build.h
diff options
context:
space:
mode:
authorJohn Drouhard <john@jmdtech.org>2021-03-26 17:07:21 (GMT)
committerJohn Drouhard <john@jmdtech.org>2022-06-10 13:45:47 (GMT)
commita2b5e6deff1545f5ca1947930fa59fa3ff236db7 (patch)
treee40719247e439840d00b9bc4228aa1c19c442ab7 /src/build.h
parent55f54511d35716c43637dee2bcb5fbc7839f967b (diff)
downloadNinja-a2b5e6deff1545f5ca1947930fa59fa3ff236db7.zip
Ninja-a2b5e6deff1545f5ca1947930fa59fa3ff236db7.tar.gz
Ninja-a2b5e6deff1545f5ca1947930fa59fa3ff236db7.tar.bz2
Introduce mechanism to provide resiliency for inputs changing while the build runs
When an edge starts to run, create a temporary lock file in the build directory, stat it, and cache its mtime. When the command finishes, use the temporary lock file's mtime from when the edge started running as the mtime that is recorded in the build log for each of the edge's output(s). Subsequent runs will use that as the mtime for the output(s). This provides robustness against inputs changing while the command itself is running. If an input is changed, the subsequent run will detect the output as dirty since its recorded mtime reflects when the build command began, not when the output was actually written to disk. Generator and restat rules are exempt from this and will continue to record their actual mtime on disk at the time the command finished in the build log (unless the restat rule cleans the output). This avoids potential infinite loops when the generator rule touches input dependencies of the output(s) or a restat rule intentionally changes implicit dependencies of its output.
Diffstat (limited to 'src/build.h')
-rw-r--r--src/build.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/build.h b/src/build.h
index d697dfb..d727a8a 100644
--- a/src/build.h
+++ b/src/build.h
@@ -234,6 +234,7 @@ struct Builder {
/// Time the build started.
int64_t start_time_millis_;
+ std::string lock_file_path_;
DiskInterface* disk_interface_;
DependencyScan scan_;