summaryrefslogtreecommitdiff
path: root/tools/run_rustc.py
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2018-08-17 22:42:26 +0200
committerBert Belder <bertbelder@gmail.com>2018-08-18 00:58:01 +0200
commit3640ea4c0d1e47c672cae94d3f3efe63a845d0ae (patch)
tree91288a4b8e5603273b288959a9d26a45f3b6c5d2 /tools/run_rustc.py
parent42e7b7b3e754a9bac9f899eb9d1542ac0becacfd (diff)
build: don't clobber rust depfile mtime when fixing its paths
This avoids ninja unnecessarily rebuilding rust targets. Add a check for problems like these to be run on appveyor.
Diffstat (limited to 'tools/run_rustc.py')
-rw-r--r--tools/run_rustc.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/run_rustc.py b/tools/run_rustc.py
index 81841eff9..f56ca8eb8 100644
--- a/tools/run_rustc.py
+++ b/tools/run_rustc.py
@@ -14,6 +14,9 @@ import util
# Updates the path of the main target in the depfile to the relative path
# from base_path build_output_path
def fix_depfile(depfile_path, base_path, build_output_path):
+ # It's important that the fixed-up depfile has the same mtime as before.
+ # Ninja relies on it to decide whether to rebuild the target it belongs to.
+ stat = os.stat(depfile_path)
with open(depfile_path, "r") as depfile:
content = depfile.read()
content_split = content.split(': ', 1)
@@ -21,6 +24,7 @@ def fix_depfile(depfile_path, base_path, build_output_path):
new_content = "%s: %s" % (target_path, content_split[1])
with open(depfile_path, "w") as depfile:
depfile.write(new_content)
+ os.utime(depfile_path, (stat.st_atime, stat.st_mtime))
def main():