[dotnet] [build] Migrate resource generation to dotnet tool#17388
Conversation
Review Summary by QodoMigrate resource generation tool from Python to C#
WalkthroughsDescription• Migrate resource generation tool from Python to C# • Replace py_binary with csharp_binary in Bazel build • Implement GenerateResourcesTool.cs with argument parsing • Remove legacy Python script and update documentation File Changes1. dotnet/private/GenerateResourcesTool.cs
|
Code Review by Qodo
1. Unvalidated --input identifier/content
|
There was a problem hiding this comment.
Pull request overview
Migrates the .NET resource generation utility used by Bazel/MSBuild from a Python script to a C# console tool, removing the Python dependency from this part of the .NET build pipeline.
Changes:
- Replaced
generate_resources_tool.pywith a new C# implementation (GenerateResourcesTool.cs) that emitsResourceUtilities.g.cs. - Updated Bazel rule documentation to reflect the C# tool invocation.
- Updated
dotnet/private/BUILD.bazelto build the generator as acsharp_binarytargetingnet10.0.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| dotnet/private/generate_resources_tool.py | Removes the prior Python-based generator implementation. |
| dotnet/private/generate_resources.bzl | Updates rule/module documentation to reference the new C# tool. |
| dotnet/private/GenerateResourcesTool.cs | Adds new C# generator tool that reads JS inputs and emits ResourceUtilities constants. |
| dotnet/private/BUILD.bazel | Switches generator target from py_binary to csharp_binary and sets net10.0. |
No python, purely dotnet/C#
💥 What does this PR do?
This pull request migrates the resource generation tool from Python to C#, ensuring that .NET developers can easily build and maintain it. The Python implementation is removed and replaced with a new C# console tool, and the Bazel build configuration is updated accordingly.
Migration from Python to C# for resource generation:
GenerateResourcesTool.csthat generates theResourceUtilitiespartial class with embedded JS resources, replacing the previous Python script. The tool processes--inputand--outputarguments and emits C# raw string literals with five quotes.generate_resources_tool.py, eliminating all Python-specific logic for resource generation.BUILD.bazelto usecsharp_binaryfor building the new C# tool instead ofpy_binary, and to reference the new C# source file.generate_resources.bzlto reflect the migration from a Python to a C# implementation.🤖 AI assistance
🔄 Types of changes