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

Which prevents spurious rebuilds of dyndeps
pull/13021/head
Dylan Baker 8 months ago
parent 3e9021a4c4
commit 2f8d51c833
  1. 12
      mesonbuild/backend/ninjabackend.py

@ -1103,8 +1103,16 @@ class NinjaBackend(backends.Backend):
scaninfo = TargetDependencyScannerInfo(
self.get_target_private_dir(target), source2object, scan_sources)
with open(pickle_abs, 'wb') as p:
pickle.dump(scaninfo, p)
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)
elem = NinjaBuildElement(self.all_outputs, depscan_file, rule_name, pickle_file)
# Add any generated outputs to the order deps of the scan target, so

Loading…
Cancel
Save