-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Summary
Today, Targets that track Inputs and Outputs do so by comparing the last-write time of each input and output. If there are discrepancies between the Inputs and Outputs, the target is executed (either fully in in-part based on the kind of discrepancy).
However, timestamps are only a proxy measure to if the input and output files are actually changed - we've introduced support in the Copy task for the concept of IsDifferent, which highlights the more fundamental property we should be comparing - that the action should be taken only if the Input(s) are materially changed compared to the Output(s).
While computing this property may be more expensive, it may lead to doing less work overall in the build, as errant file touches and imprecise use of Copy can lead to downstream Target execution.
Background and Motivation
More and more build systems use content-based checks by default these days - it provides a generally-cross-platform understanding of a file and its content, and it more closely maps to what end users actually mean when they think of inputs to an operation - the contents of the file (what it contains) are more important than when it was created.
Proposed Feature
Up to date checking in TargetUpToDateChecker.cs should have a mode of operation where the content of the files drives the decision to rebuild fully or in part. This mode should be enforceable at the whole-build level. Depending on the performance of these content hash calculations, the engine may need to compute a cache/database of hashes - this cache would need to be invalidatable and ideally reusable across builds to maximum impact.
For compatibility reasons we'd need to keep the existing time-based mode as well for several releases at minimum.
Alternative Designs
No response