FluidFramework icon indicating copy to clipboard operation
FluidFramework copied to clipboard

improvement(generate:typetests,list): Only write output file when contents differs

Open tylerbutler opened this issue 1 year ago • 1 comments

Adds a utility function to write to files only if the contents you're writing is different from what's already there. This function is used in the type test generation and flub list to ensure we only write changes when needed.

This function may be useful for other commands as well, but those changes are left for separate PRs.

I also opportunistically replaced some synchronous function calls with async counterparts.

tylerbutler avatar Jul 09 '24 00:07 tylerbutler

I think the motive I had for suggesting this work (avoid needless file churn as it could invalidate incremental build state) was flawed for multiple reasons:

  1. We don't use modification time of inputs vs outputs to do our incremental build
  2. If we did use the input vs output build times, tasks which consume other outputs could end up forever dirty due to this change, which is what I was thinking it might fix.

In conclusion: If I was right about how our build worked (and I wasn't) this would be really bad. Since I don't actually know how this part of our build works, someone else should probably make the judgement on if we want to do this.

CraigMacomber avatar Jul 17 '24 22:07 CraigMacomber

This PR has been automatically marked as stale because it has had no activity for 60 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework!