-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support binlog in build/restore of file-based programs #49009
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
base: main
Are you sure you want to change the base?
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 handling the "-bl" (binary log) argument for file-based programs during dotnet build and restore operations.
- Adds a new utility method to separate binary log arguments.
- Refactors command parsing in the Run, Restore, and Build commands to use the new utility.
- Updates test cases to validate the new behavior.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
test/dotnet.Tests/CommandTests/Run/RunFileTests.cs | Adds tests to validate binary log argument handling for build/restore commands. |
src/Cli/dotnet/LoggerUtility.cs | Introduces a new method to separate binary log arguments from other arguments. |
src/Cli/dotnet/Commands/Test/MSBuildUtility.cs | Refactors token separation using the new utility method. |
src/Cli/dotnet/Commands/Run/RunCommand.cs | Updates binary log argument separation to improve consistency. |
src/Cli/dotnet/Commands/Restore/RestoreCommand.cs | Adjusts processing of file arguments and binary log arguments for restore scenarios. |
src/Cli/dotnet/Commands/Build/BuildCommand.cs | Similar refactoring and merging of binary log arguments during build command parsing. |
@@ -61,6 +61,23 @@ private static FacadeLogger ConfigureDispatcher(List<BinaryLogger> binaryLoggers | |||
return new FacadeLogger(dispatcher); | |||
} | |||
|
|||
internal static void SeparateBinLogArguments(IEnumerable<string>? args, out List<string> binLogArgs, out List<string> nonBinLogArgs) |
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.
[nitpick] Consider adding XML documentation comments for the SeparateBinLogArguments method to explain its behavior, especially the treatment of null inputs and the criteria used to separate binlog arguments.
Copilot uses AI. Check for mistakes.
Without this PR,
dotnet build -bl Program.cs
is not supported because both args (-bl
andProgram.cs
) are treated as the "project file" argument (that's a pre-existing behavior, even for project-based programs, but for them all unknown arguments are forwarded to msbuild.exe, which we can't do when using msbuild APIs). This PR makes build/restore extract-bl
arguments just like thedotnet run
command does.