dotnet / dotnet/arcade

Allow `GenerateFileFromTemplate` to have `WriteOnlyWhenDifferent`

Open
#16,019 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
729
Forks
397
Avg merge
3d 15m
Merged PRs (30d)
149

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.