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

Fix incremental source generator #22

Merged
merged 10 commits into from
Jan 17, 2024
Merged

Conversation

GerardSmit
Copy link
Contributor

@GerardSmit GerardSmit commented Dec 11, 2023

Fixes #20


This was quite annoying, but luckily comments from @Sergio0694 popped up in my research to resolve them 😉

I used the unit test from k94ll13nn3/AutoConstructor#83 to validate if the source generator is incremental.
All unit tests (Generator.Tests and GenerationSandbox.Tests) are succeeding, without modifying them.

@virzak
Copy link
Contributor

virzak commented Dec 12, 2023

Thanks so much for the effort. Will be a look at this PR soon, in the meantime I've enabled the build for this.

Copy link

codecov bot commented Dec 16, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (97a4a06) 94.27% compared to head (de2c824) 93.95%.

Files Patch % Lines
...p.SyncMethodGenerator/SyncMethodSourceGenerator.cs 88.15% 4 Missing and 5 partials ⚠️
...p.SyncMethodGenerator/Models/ReportedDiagnostic.cs 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #22      +/-   ##
==========================================
- Coverage   94.27%   93.95%   -0.32%     
==========================================
  Files           7        8       +1     
  Lines         874      894      +20     
  Branches      194      192       -2     
==========================================
+ Hits          824      840      +16     
- Misses         23       25       +2     
- Partials       27       29       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lsoft
Copy link

lsoft commented Jan 1, 2024

sorry to bother... any prognosis to see this merged? I'm very interested to see this ISG to be fully functional and healthy!

@@ -3,6 +3,7 @@
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="Fody" Version="6.6.4" />
<PackageVersion Include="IsExternalInit" Version="1.0.3" />
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lsoft, soon. Most likely this week.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GerardSmit, thanks for pointing that out. Will ensure it gets included. BTW, if any of the commits I made after your original PR don't make sense, let me know. We should have this merged soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else look OK to me; using a ushort instead of a hacky wrapper struct is probably better. 😉

@lsoft
Copy link

lsoft commented Jan 17, 2024

So, I have switched our network subsystem from sync mode to sync+async mode with this ISG. Things looks amazing! 👍 I'm concerned about potential performance issues because of "broken" ISG pipeline. This is the only thing I want to wait for before merging my PR.

@virzak Sorry to bother, absolutely(!) no pressing here, but if you are able to share some prognosis, it would help me to build delivery plan :)

@virzak
Copy link
Contributor

virzak commented Jan 17, 2024

Hey, no problem. Thanks for the push. Looking as we speak, will merge today.

Also this came out: https://twitter.com/andrewlocknet/status/1747312256931516497?t=zgQQi6TdVqzRPz6faKW60w&s=19

@@ -25,162 +27,161 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
context.RegisterPostInitializationOutput(ctx => ctx.AddSource(
$"{CreateSyncVersionAttribute}.g.cs", SourceText.From(SourceGenerationHelper.CreateSyncVersionAttributeSource, Encoding.UTF8)));

IncrementalValuesProvider<MethodDeclarationSyntax> methodDeclarations = context.SyntaxProvider
var disableNullable =
context.CompilationProvider.Select((c, _)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GerardSmit, if you're good with this change, I'll merge.

Following this example as well as this section of the tutorial.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

The unit test is still succeeding, so the caching still works. 😄

@virzak virzak merged commit f69f105 into zompinc:master Jan 17, 2024
5 checks passed
@virzak
Copy link
Contributor

virzak commented Jan 17, 2024

Thanks a lot, @GerardSmit !!!

@lsoft
Copy link

lsoft commented Jan 18, 2024

@GerardSmit Thanks you! Your PR helped a real people to fix their real problems! 👍

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

Successfully merging this pull request may close these issues.

The source generator is completely non incremental
3 participants