Skip to content

Make the EventSource generator incremental et.al. - #64579

Merged
danmoseley merged 8 commits into
dotnet:mainfrom
teo-tsirpanis:eventsource-gen-incremental
Mar 18, 2022
Merged

Make the EventSource generator incremental et.al.#64579
danmoseley merged 8 commits into
dotnet:mainfrom
teo-tsirpanis:eventsource-gen-incremental

Conversation

@teo-tsirpanis

Copy link
Copy Markdown
Contributor

The EventSource generator was made incremental and its output is marked as auto-generated. (TIL GitHub doesn't let me reopen a PR if I have force-pushed its branch)

Fixes#64563.

c.c. @danmoseley

@ghostghost added area-System.Diagnostics.Tracing community-contribution Indicates that the PR has been added by a community member labels Jan 31, 2022
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

The EventSource generator was made incremental and its output is marked as auto-generated. (TIL GitHub doesn't let me reopen a PR if I have force-pushed its branch)

Fixes #64563.

c.c. @danmoseley

Author:teo-tsirpanis
Assignees:-
Labels:

area-System.Diagnostics.Tracing

Milestone:-

Comment threadsrc/libraries/System.Private.CoreLib/generators/EventSourceGenerator.cs Outdated
@teo-tsirpanis
teo-tsirpanisforce-pushed the eventsource-gen-incremental branch from 410e3d9 to a306b12CompareFebruary 5, 2022 19:02
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.cs Outdated
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.cs Outdated
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.Parser.cs Outdated
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.Parser.cs Outdated
sharwell
sharwell previously requested changes Feb 7, 2022
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.cs Outdated
@ghostghost added needs-author-action An issue or pull request that requires more info or actions from the author. and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels Feb 7, 2022
@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

I updated the generator to only use the semantic model provided by CreateSyntaxProvider's transform delegate, completely removing the need for injecting the Compilation into the pipeline, and drastically simplifying it.

Can you review it again?

Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.cs Outdated
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.cs Outdated
Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.cs Outdated

@chsienkichsienki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You'll want to implement IEquatable<> on the EventSourceClass to ensure you don't do duplicate work unnecessarily, but otherwise LGTM.

Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.Emitter.cs Outdated

@sharwellsharwell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This approach is much better! So glad to see the compilation issue resolved 👍

Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.Parser.cs Outdated
@sharwell
sharwell dismissed their stale reviewFebruary 8, 2022 00:07

The problematic compilation-ignoring comparer has been eliminated in favor of clean data extraction.

@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

All PR feedback was addressed.

For the record, source generators (especially the incremental ones) are awesome.

@tommcdon

Copy link
Copy Markdown
Member

@tommcdon

Copy link
Copy Markdown
Member

@stephentoub@noahfalk@hoyosjs just a friendly ping, any concerns with moving forward with this change?

Comment threadsrc/libraries/System.Private.CoreLib/gen/EventSourceGenerator.Parser.cs Outdated

@noahfalknoahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I only skimmed, but LGTM. Thanks!

@danmoseley

Copy link
Copy Markdown
Contributor

Is this good to merge now?

@chsienki

Copy link
Copy Markdown
Member

@danmoseley Looks good from the compiler side, modulo the revert of GetBestTypeByMetadataName. Not a blocker, but as discussed on the regex generator PR it can be a subtle breaking change so suggest switching it back.

@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

OK, I reverted to GetBestTypeByMetadataName.

@danmoseley

Copy link
Copy Markdown
Contributor

@noahfalk@hoyosjs is this mergeable (after build break is fixed..)

@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

Build what? Oh crap, I had built it from VS and it worked. I will take a look soon. 😥

@teo-tsirpanis
teo-tsirpanisforce-pushed the eventsource-gen-incremental branch from ebd8b7b to ba0f865CompareMarch 17, 2022 21:51
@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

Turns out #66434 changed the location of IsExternalInit.cs. It builds on my machine after a rebase. Let's see now...

@teo-tsirpanis
teo-tsirpanisforce-pushed the eventsource-gen-incremental branch from ba0f865 to ee127b9CompareMarch 18, 2022 00:07
@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

Ahhh, what went wrong this time?

@chsienki I removed GetBestTypeByMetadataName. This generator is only internally used by corelib, so there is no need for keeping backwards compatibility over an edge-case scenario.

@noahfalk

Copy link
Copy Markdown
Member

@noahfalk@hoyosjs is this mergeable (after build break is fixed..)

Yep!

@danmoseley
danmoseley merged commit 4d39501 into dotnet:mainMar 18, 2022
@danmoseley

Copy link
Copy Markdown
Contributor

Thanks @teo-tsirpanis !

@teo-tsirpanis
teo-tsirpanis deleted the eventsource-gen-incremental branch March 18, 2022 12:53
@teo-tsirpanis

Copy link
Copy Markdown
ContributorAuthor

BTW are you still on vacation @noahfalk? Perhaps you forgot to clear your GitHub profile status.

@noahfalk

Copy link
Copy Markdown
Member

nope I've been back a good while, thanks for the heads up : )

radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Mar 30, 2022
@ghostghost locked as resolved and limited conversation to collaborators Apr 18, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Diagnostics.Tracingcommunity-contributionIndicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EventSource source generator should mark both source and IL as autogenerated

7 participants

@teo-tsirpanis@tommcdon@danmoseley@chsienki@noahfalk@sharwell@stephentoub