backend/ninja: don't rewrite the pickle data if it hasn't changed

Which prevents spurious rebuilds of dyndeps
This commit is contained in:
Dylan Baker 2024-03-28 13:57:18 -07:00
parent 3e9021a4c4
commit 2f8d51c833
1 changed files with 10 additions and 2 deletions

View File

@ -1103,6 +1103,14 @@ class NinjaBackend(backends.Backend):
scaninfo = TargetDependencyScannerInfo(
self.get_target_private_dir(target), source2object, scan_sources)
write = True
if os.path.exists(pickle_abs):
with open(pickle_abs, 'rb') as p:
old = pickle.load(p)
write = old != scaninfo
if write:
with open(pickle_abs, 'wb') as p:
pickle.dump(scaninfo, p)