8000 Support binlog in build/restore of file-based programs by jjonescz · Pull Request #49009 · dotnet/sdk · GitHub
[go: up one dir, main page]

Skip to content

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jjonescz
Copy link
Member
@jjonescz jjonescz commented May 16, 2025

Without this PR, dotnet build -bl Program.cs is not supported because both args (-bl and Program.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 the dotnet run command does.

@jjonescz jjonescz requested a review from a team May 16, 2025 10:44
@jjonescz jjonescz added the Area-run-file Items related to the "dotnet run <file>" effort label May 16, 2025
@jjonescz jjonescz marked this pull request as ready for review May 16, 2025 14:42
@Copilot Copilot AI review requested due to automatic review settings May 16, 2025 14:42
Copy link
Contributor
@Copilot Copilot AI left a 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)
Copy link
Preview
Copilot AI May 16, 2025

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.

@RikkiGibson RikkiGibson self-assigned this May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-run-file Items related to the "dotnet run <file>" effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0