-
Notifications
You must be signed in to change notification settings - Fork 5k
Convert genRuntimeEventSources to a C# source generator #114810
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
Convert genRuntimeEventSources to a C# source generator #114810
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR converts a Python-based code generation script into a C# source generator to remove a direct Python dependency from our managed build.
- Converts the logic for manifest file processing and event method generation from Python to C#.
- Adopts Roslyn incremental generator APIs, new string interpolation with raw strings, and modern collection initialization.
Files not reviewed (5)
- eng/python.targets: Language not supported
- src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj: Language not supported
- src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj: Language not supported
- src/libraries/System.Private.CoreLib/gen/System.Private.CoreLib.Generators.csproj: Language not supported
- src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj: Language not supported
c1d8876
to
8a2bbb0
Compare
Nice! |
src/libraries/System.Private.CoreLib/gen/NativeRuntimeEventSourceGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/gen/NativeRuntimeEventSourceGenerator.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/gen/NativeRuntimeEventSourceGenerator.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @tarekgh, @tommcdon, @pjanotti |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR converts the runtime event sources generation from a Python‐based process to a native C# source generator, eliminating the direct Python dependency in our managed build.
- Removed Python-based eventing file generation targets and related imports.
- Added a new C# source generator (NativeRuntimeEventSourceGenerator.cs) and updated project files to use AdditionalFiles for event manifest inclusion.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj | Removed Python-based generation targets and replaced them with an AdditionalFiles group for event manifest inclusion when FeaturePerfTracing is enabled. |
src/libraries/System.Private.CoreLib/gen/System.Private.CoreLib.Generators.csproj | Added a new source generator and marked the project as a Roslyn component. |
src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj | Eliminated Python-based targets and added AdditionalFiles entries for manifest and inclusion list files. |
src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj | Similar removal of Python-generation logic with an AdditionalFiles group addition. |
eng/python.targets | Removed entire Python target definitions as they are no longer needed. |
Directory.Build.targets | Removed the import of python.targets to reflect the new build configuration. |
Comments suppressed due to low confidence (1)
src/libraries/System.Private.CoreLib/gen/System.Private.CoreLib.Generators.csproj:17
- Ensure that the new source generator 'NativeRuntimeEventSourceGenerator.cs' is accompanied by comprehensive tests to verify its output across different build scenarios.
<Compile Include="NativeRuntimeEventSourceGenerator.cs" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of testing do we have in place to validate this is producing the same output as the previous script was?
I locally validated of the results of both the scripts to ensure they were byte-for-byte identical. |
/ba-g failures are unrelated |
Convert this script to C# to remove the only direct python usage from within our managed build.
I primarily converted this script with VSCode's Copilot's Agent mode with ChatGPT 4.1, with a few logic adjustments as necessary to match the python script's codegen.