Skip to content

CmdLine parsing was extracted from XMake and the implementation is visible to dotnet#12704

Merged
MichalPavlik merged 5 commits into
mainfrom
dev/mipavlik/commandline-parser
Nov 10, 2025
Merged

CmdLine parsing was extracted from XMake and the implementation is visible to dotnet#12704
MichalPavlik merged 5 commits into
mainfrom
dev/mipavlik/commandline-parser

Conversation

@MichalPavlik

Copy link
Copy Markdown
Member

Context

In some cases dotnet needs to process MSBuild cmdline switches including response files.

Changes Made

The parsing logic was pulled out from XMake to isolate it in the internal type, making it easily reusable in the .NET SDK project.

Testing

All existing tests are passing.

Notes

The goal of this PR isn’t to refactor the entire API—that’s something we can consider tackling later on.

Copilot AI review requested due to automatic review settings October 29, 2025 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 8 changed files in this pull request and generated 9 comments.

Comment thread src/MSBuild/CommandLine/CommandLineParser.cs Outdated
Comment thread src/MSBuild/XMake.cs Outdated
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
Comment thread src/MSBuild/XMake.cs Outdated
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
Comment thread src/MSBuild/AssemblyInfo.cs
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs
The `usingSwitchesFromAutoResponseFile` field has been removed from the `CommandLineParser` class, along with the associated logic that set its value. This includes the removal of the check for `switchesFromAutoResponseFile.HaveAnySwitchesBeenSet()` and the assignment to this field.

The `ResetGatheringSwitchesState` method has been updated to no longer reset this field, as it is no longer needed. These changes simplify the class by eliminating redundant state management related to auto-response file switches, improving maintainability.
Comment thread src/MSBuild/CommandLine/CommandLineParser.cs

@baronfel baronfel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this :)

Comment thread src/MSBuild/CommandLine/CommandLineParser.cs

@rainersigwald rainersigwald left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't get to dig in to all the details but this sounds directionally good to me.

@MichalPavlik MichalPavlik merged commit a73379b into main Nov 10, 2025
10 checks passed
@MichalPavlik MichalPavlik deleted the dev/mipavlik/commandline-parser branch November 10, 2025 15:16
JanProvaznik added a commit to JanProvaznik/msbuild that referenced this pull request Nov 19, 2025
YuliiaKovalova pushed a commit that referenced this pull request Nov 20, 2025
reverts #12693 #12704

### Context
unblocking VMR insertion
dotnet/dotnet#3091
### Changes Made


### Testing


### Notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants