mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 12:49:10 +00:00
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.
This commit is contained in:
parent
42e7b7b3e7
commit
3640ea4c0d
2 changed files with 15 additions and 1 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue