Add necessary space before "-r" extra argument for CoreRT#1951
Add necessary space before "-r" extra argument for CoreRT#1951Beau-Gosse-dev wants to merge 1 commit intodotnet:masterfrom
Conversation
Without this, the commands come out like "-bl:benchmarkdotnet.binlog-r win-x64" and dotnet fails to restore/build/publish
adamsitnik
left a comment
There was a problem hiding this comment.
Big thanks for you contribution! I am very excited to see you working on getting CoreRT/NativeAOT working with BenchmarkDotNet!
You fix solves the problem for CoreRT, but it would be great if we could make it more generic so it could be applied to other toolchains as well.
Since the extra arguments are appended here:
BenchmarkDotNet/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliCommand.cs
Lines 142 to 144 in 9b990df
after the custom MsBuild arguments, I think it would be better to append space to the custom msbuild arg:
- return string.Join(" ", msBuildArguments.Select(arg => arg.TextRepresentation));
+ return string.Join(" ", msBuildArguments.Select(arg => arg.TextRepresentation)) + ' ';What do you think?
|
@adamsitnik Thanks for the quick review! I see what you mean about making it more generic, and not just limiting this to CoreRT. I actually first put the extra space inside the DotNetCliCommand.GetRestoreCommand method, but then realized it would be needed inside Build and Publish also. I don't love the idea of putting the extra space at the end of GetCustomMsBuildArguments because then the extraArguments tightly depends on GetCustomMsBuildArguments being directly before extraArguments in the list of arguments. If someone was to change or move GetCustomMsBuildArguments later, that could break this again. What do you think about instead creating an extension method called It seems like there are a lot of places where either leading or trailing spaces are hard-coded as magic strings, which seems dangerous and inconsistent. Such as these places: To me, it seems better to just deal with the spaces between arguments in one place, like this proposed AppendArgument method. Thoughts? |
It's a very good idea! 👍 |
|
@adamsitnik I've opened a new PR with the changes we talked about plus some other cleanup and the other output path fix. It's here: #1955 I thought it would be easier to have it all in one place with a better-named branch. |
Without this, the commands come out like
dotnet restore /p:DebugType=portable -bl:benchmarkdotnet.binlog-r win-x64 /p:UseSharedCompilation=false /p:BuildInParallel=false /m:1 /p:Deterministic=true /p:Optimize=trueand dotnet fails to restore/build/publish