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

Add OptIn mode for source generator #1861

Merged
merged 23 commits into from
Nov 8, 2024
Merged

Conversation

manodasanW
Copy link
Member

@manodasanW manodasanW commented Nov 4, 2024

This change adds a couple new modes for the source generator. The source generator can now either run in Auto mode which eventually would be a build task or in OptIn mode. By default, in the default mode of true, in WinUI / UWP scenarios, it would run in Auto mode. Whereas in the other scenarios, it would run in OptIn mode. This allows to address the feedback where it was source generating vtables in scenarios where it is probably not needed. To enable the OptIn mode, the GeneratedWinRTExposedType and the GeneratedWinRTExposedExternalType attributes are added which allows to generate the vtables based on the use of the attributes. These attributes are added only for the .NET 8 and later versions given the upcoming .NET 6 EOL.

Contributes to #1814

@manodasanW manodasanW requested a review from Sergio0694 November 4, 2024 02:32
Copy link
Member

@Sergio0694 Sergio0694 left a comment

Choose a reason for hiding this comment

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

Did a first pass (haven't tested it yet), but looks good so far! 🙂

docs/aot-trimming.md Show resolved Hide resolved
docs/aot-trimming.md Show resolved Hide resolved
docs/aot-trimming.md Outdated Show resolved Hide resolved
src/WinRT.Runtime/Attributes.cs Show resolved Hide resolved
src/WinRT.Runtime/ComWrappersSupport.net5.cs Outdated Show resolved Hide resolved
@manodasanW manodasanW merged commit 71671e1 into master Nov 8, 2024
10 checks passed
@manodasanW manodasanW deleted the manodasanw/optinMode2 branch November 8, 2024 04:19
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.

2 participants