-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[dotnet] Add bazel rules for dotnet format and paket deps #16986
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
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to f4e21ac
Previous suggestions✅ Suggestions up to commit 3c535fc
Suggestions up to commit b818b18
✅ Suggestions up to commit b70828e
Suggestions up to commit 084192d
✅ Suggestions up to commit 4cd3ab0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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 adds hermetic Bazel rules for .NET development tooling, enabling automated formatting and dependency management without requiring local .NET SDK installations.
Changes:
- Adds
dotnet_formatrule for runningdotnet formaton Selenium WebDriver source projects - Adds
paket_depsrule for managing .NET dependencies via paket (update/install modes) - Integrates dotnet formatting into the repository's formatting workflow via
format.shand Rakefile
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/private/dotnet_format.bzl | New Bazel rule that generates cross-platform scripts to run dotnet format on WebDriver and Support projects |
| dotnet/private/paket_deps.bzl | New Bazel rule that generates cross-platform scripts to run paket update/install commands |
| dotnet/defs.bzl | Exports the new dotnet_format and paket_deps rules for use in BUILD files |
| dotnet/BUILD.bazel | Defines targets for format, paket-update, and paket-install using the new rules |
| scripts/format.sh | Adds dotnet format to the repository-wide formatting script |
| Rakefile | Adds rake task for running dotnet format via Bazel |
4cd3ab0 to
084192d
Compare
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
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
084192d to
b70828e
Compare
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
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
b70828e to
b818b18
Compare
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
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
b818b18 to
3c535fc
Compare
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
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
3c535fc to
4c6c2db
Compare
Add hermetic bazel rules that use the rules_dotnet toolchain: - dotnet_format: runs `dotnet format` on src projects - paket_deps: runs `paket update` or `paket install` Both rules generate cross-platform scripts (Unix/Windows). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4c6c2db to
b9c3b7c
Compare
The Rakefile was out of sync after rebasing - it retained the old monolithic structure instead of adopting trunk's new split structure that loads .rake files inside namespace blocks. This fixes: Don't know how to build task 'bazel:affected_targets' Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
User description
🔗 Related Issues
Part of lint/format tooling improvements
💥 What does this PR do?
Adds hermetic Bazel rules that use the rules_dotnet toolchain:
dotnet_format: runsdotnet formaton src projects viabazel run //dotnet:formatpaket_deps: runspaket updateorpaket installviabazel run //dotnet:paket-updateorbazel run //dotnet:paket-install//dotnet:formatto format.sh fileBoth rules generate cross-platform scripts (Unix/Windows) and use the Bazel-managed dotnet SDK rather than requiring a local installation.
🔧 Implementation Notes
@rules_dotnet//dotnet:toolchain_typeto get the hermetic dotnet executablectx.target_platform_has_constraintfor Windows vs Unix script generationBUILD_WORKSPACE_DIRECTORYwhen run withbazel runpaket_depsrule includes helpful output suggesting the follow-uppaket2bazelcommand💡 Additional Considerations
The format target currently hardcodes the two src project paths; could be parameterized if neededwent ahead and fixed it
🔄 Types of changes
PR Type
Enhancement
Description
Add hermetic Bazel rules for dotnet format and paket dependencies
Create cross-platform scripts (Unix/Windows) using rules_dotnet toolchain
Integrate dotnet format into format.sh and Rake build tasks
Enable paket update/install via bazel run with helpful follow-up guidance
Diagram Walkthrough
File Walkthrough
defs.bzl
Export new dotnet format and paket rulesdotnet/defs.bzl
dotnet_formatrule fromdotnet/private/dotnet_format.bzlpaket_depsrule fromdotnet/private/paket_deps.bzlformat.sh
Integrate dotnet format into format scriptscripts/format.sh
bazel run //dotnet:formatfor dotnet source formattingRakefile
Add Rake task for dotnet formattingRakefile
dotnet:formatRake taskbazel run //dotnet:formatvia Bazel integrationBUILD.bazel
Define format and paket targetsdotnet/BUILD.bazel
dotnet_formatandpaket_depsrulespaket-updatetarget with mode="update"paket-installtarget with mode="install"formattarget for dotnet formattingdotnet_format.bzl
New rule for hermetic dotnet format executiondotnet/private/dotnet_format.bzl
dotnet_formatrule using rules_dotnet toolchainBUILD_WORKSPACE_DIRECTORYenvironmentvariable
Selenium.WebDriver.csprojandSelenium.WebDriver.Support.csprojpaket_deps.bzl
New rule for paket dependency managementdotnet/private/paket_deps.bzl
paket_depsrule with configurable mode attribute(update/install)
detection
paket2bazelcommand