Buildalyzer icon indicating copy to clipboard operation
Buildalyzer copied to clipboard

Add API to retrieve compiler command-line and arguments from `IAnalyzerResult`

Open siegfriedpammer opened this issue 2 years ago • 1 comments

Proposed API:

interface IAnalyzerResult
{
+ /// <summary>
+ /// Gets the compiler command produced by the `CoreCompile` task.
+ /// </summary>
+ string Command { get; }
+ /// <summary>
+ /// Gets the arguments passed to the compiler produced by the `CoreCompile` task.
+ /// </summary>
+ IEnumerable<string> CompilerArguments { get; }
}

The use-case behind this is that I want to use Roslyn's CSharpCommandLineParser to get the correct compilation and parser options. Currently I have to implement my own MSBuild logger similar to https://github.com/daveaglick/Buildalyzer/blob/main/src/Buildalyzer/Logging/EventProcessor.cs to get to the raw command.

Would accept a PR that implements this feature?

siegfriedpammer avatar Sep 14 '22 16:09 siegfriedpammer

Would accept a PR that implements this feature?

Yeah, absolutely - Buildalyzer has an intentionally narrow scope, but this feature sounds like it fits right in with the goal of easily providing information about the build and compilation process.

My only request would be that integration tests are provided similar to the existing ones (I don't think you'll need any new projects under test, just a new parameterized test or two using the existing integration test setup that verifies the feature against different project types).

Let me know if you need a lift with anything!

daveaglick avatar Sep 15 '22 22:09 daveaglick

New release of Buildalyzer with this feature went out last night - thanks again!

daveaglick avatar Sep 23 '22 16:09 daveaglick