-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support dotnet clean file.cs
#49511
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
Support dotnet clean file.cs
#49511
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 adds support for the command "dotnet clean file.cs" to clean build artifacts for file-based programs and updates associated tests, command parsing, and documentation.
- Updates test snapshots and schemas for new argument syntax for file-based programs.
- Adds new tests and command paths to verify clean behavior using file-based entry points.
- Enhances the VirtualProjectBuildingCommand with a NoBuildMarkers property and updates CleanCommand/API accordingly.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh | Updates command completion text to include file-based programs. |
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | Adds tests for cleaning file-based programs and verifies artifact deletion. |
test/dotnet.Tests/CommandTests/MSBuild/GivenDotnetCleanInvocation.cs | Updates CleanCommand invocation tests with appropriate casts. |
test/dotnet.Tests/CliSchemaTests.cs | Adjusts CLI schema to reflect the new argument naming and description. |
src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | Introduces NoBuildMarkers property and conditionally skips writing build markers. |
src/Cli/dotnet/Commands/Clean/CleanCommandParser.cs | Renames and adjusts arguments for enhanced file-based program support. |
src/Cli/dotnet/Commands/Clean/CleanCommand.cs | Updates command creation logic and return types for file-based commands. |
documentation/general/dotnet-run-file.md | Adds documentation for the new "dotnet clean file.cs" behavior. |
@dotnet/run-file for reviews, thanks |
@RikkiGibson for another review, thanks |
/// If <see langword="true"/>, no build markers are written | ||
/// (like <see cref="BuildStartCacheFileName"/> and <see cref="BuildSuccessCacheFileName"/>). | ||
/// </summary> | ||
public bool NoBuildMarkers { get; init; } |
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.
So it looks like this controls producing the cache files or not, while NoCache
controls checking the cache files or not? Is that right?
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.
Yes, I can clarify that in the comments probably, thanks.
{ | ||
public static CleanCommand FromArgs(string[] args, string msbuildPath = null) | ||
public static CommandBase FromArgs(string[] args, string? msbuildPath = null) |
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.
Why change the return type?
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.
This calls FromParseResult which can now return either VirtualProjectBuildingCommand or CleanCommand. That's how other commands were changed as well (like build, restore, publish).
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.
LGTM with minor questions
Part of #48250.