Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow EmitCompilerGeneratedFiles to specify specific generators #56113

Closed
Youssef1313 opened this issue Sep 2, 2021 · 5 comments
Closed

Allow EmitCompilerGeneratedFiles to specify specific generators #56113

Youssef1313 opened this issue Sep 2, 2021 · 5 comments

Comments

@Youssef1313
Copy link
Member

In a case where a project has couple of generators, I'm only interested in persisting a specific generator to disk. The current design doesn't seem to allow that?

Proposal

Add a new MSBuild property, for example GeneratorFullyQualifiedNamesToPersist.
If the property value isn't set, keep the current behavior. Otherwise, treat the property value as a list of generators fully qualified names separated by a semicolon, e.g:

<GeneratorFullyQualifiedNamesToPersist>MyApp.Generators.MyAwesomeGenerator1;MyApp.Generators.MyAwesomeGenerator4</GeneratorFullyQualifiedNamesToPersist>
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Language Design untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 2, 2021
@Youssef1313
Copy link
Member Author

cc @chsienki

@sharwell
Copy link
Member

sharwell commented Sep 8, 2021

💡 I worked around this issue in DotNetAnalyzers/StyleCopAnalyzers#3343 by adding one of the source generator output locations to .gitignore.

@Youssef1313
Copy link
Member Author

Nice! I haven't really thought about it. But unfortunately it might not work well for my case. I'm in a case where the compilation fails if the generated files of a specific generator are persisted (errors say duplicate definition of things that are generated). I'm not yet able to determine the root cause of that (it's likely to be some issue in the codebase rather than a compiler issue). But the workaround is still very helpful if I encountered that in another situation or I could fix the duplicate definition issue.

@jaredpar jaredpar added Bug and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 9, 2021
@jaredpar jaredpar added this to the 17.1 milestone Sep 9, 2021
@jcouv jcouv modified the milestones: 17.1, 17.2 Mar 17, 2022
@Youssef1313
Copy link
Member Author

The request here is to select specific generators that will emit files to disk. Another request (https://stackoverflow.com/questions/71821116) was to select specific files to be emitted to disk.

@jcouv jcouv modified the milestones: 17.2, 17.3 May 14, 2022
@jaredpar
Copy link
Member

Closing as I don't think the granularity here is worth the extra complexity to our build process. I do understand the value in making sure clients can determine which files came from which generators (which I believe we've achieved). But I don't think we need the extra complexity of only emitting certain files to disk here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants