arcade icon indicating copy to clipboard operation
arcade copied to clipboard

Allow `GenerateFileFromTemplate` to have `WriteOnlyWhenDifferent`

Open Youssef1313 opened this issue 5 months ago • 0 comments

Today we have this usage:

https://github.com/microsoft/testfx/blob/f548433961344ee1629c5b04c35d99efc9fdd860/src/Platform/Microsoft.Testing.Platform/Microsoft.Testing.Platform.csproj#L96-L110

That breaks build incrementality very badly as we are always writing the file after PrepareForBuild, causing CoreCompile to always be considered not up-to-date.

One potential fix on our side is to adjust the target to produce a "cache" file based on the hash of inputs, write the cache file only if different, and adjust the target input to be the "cache" file and adjust the output to be the generated file as well.

But a simpler fix would be if Arcade just allows WriteOnlyWhenDifferent. I know that it's different from the above fix in the sense that GenerateFileFromTemplate will still run, but its cost will be low. The really important thing for us is to have having compilations being always not up-to-date.

Youssef1313 avatar Jul 31 '25 18:07 Youssef1313