Protobuild icon indicating copy to clipboard operation
Protobuild copied to clipboard

Don't overwrite .csproj files if they are identical to the output

Open jamesford42 opened this issue 8 years ago • 7 comments

Proposal: support incremental generation, such that everything isn't overwritten every time it is run.

Step1. Keep track of output files (ie, .csproj(s) which protobuild generated) and all input files that it affected the generation process of that output file (ie, the related templates).

Step2. Serialize this information in some plain text intermediate files. These could be useful for assigning the 'inputs' and 'outputs' when protobuild from within a buildtask, for example.

Step3. When the incremental flag is set, only generate output items that have modified inputs since the last build. (slight simplification of whats really involved, but you get the idea).

jamesford42 avatar Jan 18 '17 22:01 jamesford42

@hach-que

The goal with this being not having Protobuild touch files that don't need to change. This keeps VS from triggering reloads of projects if nothing actually changed.

Could be as simple as generating projects/solutions in memory then loading the existing solution/project and doing a comparison before writing the new file to disk. Would add a tiny amount of extra time to generation, but would make things nicer.

tomspilman avatar Jan 18 '17 22:01 tomspilman

I want to support this (it's been on my list for a while), but not as a special flag. My plan is to just compare the output of the generation with the current files on disk, and not overwrite the .csproj if it's the same.

hach-que avatar Jan 19 '17 00:01 hach-que

That's fine as a built in feature. It would be a fine improvement. But id still really like to have a clean manifest file dumped for hooking up to my own msbuild task's @outputs. This would allow me to write a more reusable targets in which I do not need to explicitly list the generated project files.

jamesford42 avatar Jan 19 '17 03:01 jamesford42

I'm confused as to what you're trying to achieve. Are you trying to modify the resulting .csproj files? That can be done with AdditionalProjectTransforms.xslt or by overriding the other XSLT files.

hach-que avatar Jan 19 '17 03:01 hach-que

Oh, no. I was thinking of something more like a "generated_files.txt" that gets dumped out after calling protobuild -generate, containing a simple newline separated list of files that were generated.

jamesford42 avatar Jan 19 '17 04:01 jamesford42

The list of .csproj files is predictable. It's just the Folder and Name in the .definition files inside the Build/Projects folder.

hach-que avatar Jan 19 '17 06:01 hach-que

Oh ok, that sounds easy enough, thanks!

jamesford42 avatar Jan 19 '17 19:01 jamesford42