-
-
Notifications
You must be signed in to change notification settings - Fork 734
Convert mpc and msbuild task package to a roslyn source generator #1599
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
Conversation
- remove project dependency - update dependency package version
The source generator will altogether deprecate this.
It presumably should be 3.8, but it doesn't compile with 3.8 at this point.
This will help with cacheability.
…agePack-CSharp into sourceGenerator1495
* Consolidate `TypeCollector` across analyzer and source generator. * Use `System.Text.Json` instead of `TinyJsonReader`. * Remove all diagnostic reporting from the source generator. * Make the source generator depend on the analyzer, so that user gets diagnostics while using source generator by way of the analyzer.
@Y-YoL let me get the unity build working, and then can you try with the source generator again? I suspect it will only work when you set the analyzer label on the System.Text.Json.dll file as you do with the other source generator DLLs. |
src/MessagePack.UnityClient/Assets/Scripts/MessagePack/Resolvers/StandardResolver.cs
Show resolved
Hide resolved
@Y-YoL do you have any idea how to resolve this warning that appears a lot in the unity build?
|
…e-from-unity' into sourceGenerator1495
I guess the CS8632 warnings are a pre-existing issue. I'd still love to solve it, but it's not blocking this PR. |
The only important part is "additionalCompilerArguments", but there are many differences because Unity automatically migrates
Regarding CS8632 in Unity, it is necessary to write in the configuration file. |
…e-setting Set nullable in unity
I have unity installed and it looks like the source generator broke somewhere along the way. Probably when I added the dependency from the source generator to the analyzer project. I'm looking into it now. |
This is important for dependency reasons, since code fixes bring in more dependencies than analyzers, and `dotnet build` and unity don't contain the dependencies required for code fixes.
I fixed the build issues in unity it seems, but the analyzer and source generator no longer work at all (no errors, no warnings, no code gen). I had them working a while back, so I guess I broke something. Any ideas, @Y-YoL? |
Downgrading the System.Text.Json dependency to 5.0.0 gets the analyzer and source generator to work. |
This completely replaces mpc and the msbuild task package with a C# roslyn Source Generator.
NuGet package impact:
MessagePack.MSBuild.Tasks
MessagePack.SourceGenerator
MessagePack.Generator
mpc
. Unity users should now consume the source generator contained in theMessagePack.SourceGenerator.Unity.zip
file.MessagePack.SourceGenerator
MessagePack.SourceGenerator.Unity.zip
Ideas for future work (after this PR)
[MessagePackFormatter]
attribute on each[MessagePackObject]
(provided the class is declared aspartial
) so that the default in-library resolvers will find the source generated formatter.MessagePackFormatterAttribute
derives fromIMessagePackFormatter<T>
is only performed for one possible place where the attribute can appear instead of everywhere it may appear. Field and property searches are also repeated in many places, again with inconsistent code handling them.Remaining tasks
FullModel
type hierarchy has functional equality comparers.Compile Remove
items in the source generator test projects.Closes #1495