[ EDIT by @sschmid ]
I edited the issue description because this issue is now the main issue for the new code generator
dotnet's source generators, specially IIncrementalGenerator may be a valid alternative to the current approach with Jenny
Learn about dotnet Incremental Generators:
While migrating to dotnet source generators, I will use the opportunity to update and improve the generated code:
- add namespaces support for components and contexts
- support multiple projects and multiple Unity asmdef
I already made good progress but it's still in research state. Any help from the community is greatly appreciated! Please feel free to engage and help in the conversation if you can! 🙏
Tasks
Generators
Attributes
original message from issue author:
Hi,
I have a suggestion and would want to contribute.
As in official code generation guide by Unity - https://docs.unity3d.com/Manual/roslyn-analyzers.html - we can use separate project and create dll which unity will use right in it's code compilation steps.
We already have a separate project for it - Jehny, all we need is to make sure that code gen is done by Microsoft Roslyn Source Generators, and put a label “RoslynAnalyzer” for the DLL inside the release branch (create a Unity package)
This way we don't need to use Jehny Server for constant monitoring of changes, and it will help clean up the workflow.
Here's some code that we need to use for Roslyn Source Generators
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using System.Text
[Generator]
public class ExampleSourceGenerator : ISourceGenerator
{
}
Hope it will be helpful.
[ EDIT by @sschmid ]
dotnet's source generators, specially
IIncrementalGeneratormay be a valid alternative to the current approach with JennyLearn about dotnet Incremental Generators:
While migrating to dotnet source generators, I will use the opportunity to update and improve the generated code:
I already made good progress but it's still in research state. Any help from the community is greatly appreciated! Please feel free to engage and help in the conversation if you can! 🙏
Tasks
Generators
OBSOLETEComponent EntityApiInterface Generator (Multiple Contexts)OBSOLETEComponent GeneratorOBSOLETEContexts GeneratorOBSOLETEContextObserver GeneratorOBSOLETEFeatureClass GeneratorAttributes
OBSOLETECustomEntityIndexAttributeOBSOLETEEntityIndexGetMethodAttributeOBSOLETEComponentNameAttributeOBSOLETEDontGenerateAttributeOBSOLETEFlagPrefixAttributeOBSOLETEPostConstructorAttributeOBSOLETEPrimaryEntityIndexAttributeoriginal message from issue author:
Hi,
I have a suggestion and would want to contribute.
As in official code generation guide by Unity - https://docs.unity3d.com/Manual/roslyn-analyzers.html - we can use separate project and create dll which unity will use right in it's code compilation steps.
We already have a separate project for it - Jehny, all we need is to make sure that code gen is done by Microsoft Roslyn Source Generators, and put a label “RoslynAnalyzer” for the DLL inside the release branch (create a Unity package)
This way we don't need to use Jehny Server for constant monitoring of changes, and it will help clean up the workflow.
Here's some code that we need to use for Roslyn Source Generators
Hope it will be helpful.