AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 60 forks source link

Empty output files #213

Closed as-ivanov closed 4 years ago

as-ivanov commented 4 years ago

Hi,

I'd like to know, if there is any reason why the library generates output file for every member in project, instead of just members marked with corresponding attribute? As a result there are plenty useless files containing only preamble and namespaces in output folder generated for members without marker attribute.

Also can I somehow avoid getting excess output?

AArnott commented 4 years ago

Duplicate of #161

as-ivanov commented 4 years ago

Hi @AArnott,

Why this was closed as a duplicate? #161 describes cases with unexpected behavior (empty emit and error during emit), while in my case everything works as expected and I'm talking about optimization exclusively: avoid creating empty files for members without trigger attribute which are not supposed to be processed.

amis92 commented 4 years ago

Hi @as-ivanov,

This is currently by-design. In essence, it's helping us simplify up-to-date checks.

For a longer discussion and a "workaround", see https://github.com/AArnott/CodeGeneration.Roslyn/issues/33#issuecomment-398475490

You can open an issue for a "Feature Request" asking for behavior change, and we may take it into account at some point.

AArnott commented 4 years ago

I don't know how the design would change and still keep the incremental build correct and fast.