Skip to content

Commit

Permalink
backend/ninja: don't rewrite the pickle data if it hasn't changed
Browse files Browse the repository at this point in the history
Which prevents spurious rebuilds of dyndeps
  • Loading branch information
dcbaker committed Mar 29, 2024
1 parent 3e9021a commit 2f8d51c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,8 +1103,16 @@ def generate_dependency_scan_target(self, target: build.BuildTarget,

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
Expand Down

0 comments on commit 2f8d51c

Please sign in to comment.