orleans
orleans copied to clipboard
Use Incremental Generators for source-generation
The source-generator at https://github.com/dotnet/orleans/blob/main/src/Orleans.CodeGenerator/OrleansSourceGenerator.cs is using the deprecated https://github.com/dotnet/roslyn/blob/main/docs/features/source-generators.md.
We should be using https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md
plan:
- [x] add test project & CI for the existing source-generator - #9459
- [ ] add code coverage for existing source-generator
- [ ] split the source generator into multiple small source-generator
- [ ] migrate each small source generator to use incremental generators
We block the source generator from running in VS anyway, so it's not urgent to migrate to the incremental model but I agree that it could be valuable in the long run.
Are there tests for the source-generator? do the orleans integration tests cover this as it's required for orleans to work?
There aren't any specific tests other than the integration tests, which (hopefully) give good coverage. They test many corner cases like generics, nested types, various other constructs. Some of the tests are (unfortunately) indirect: the existence of a type triggers codegen, and the "test" is that the resulting code doesn't break the build.
It would be ideal if we could chop the source generator up into one or more incremental generators and make it more testable, and let it share code with the analyzers. It would take a lot of work, I believe.
@ReubenBond I updated the description of this issue with a suggested plan for getting this done safely