Remove unnecessary handling of verbosity in RestoreCommand
We were taking care to set the console verbosity to minimal, but only when no verbosity argument is passed. However, the default verbosity for all CLI msbuild commands is already minimal and so we can just get out of the way.
This commit is contained in:
parent
1421c10f1d
commit
20b0b820a8
2 changed files with 2 additions and 27 deletions
|
@ -19,7 +19,7 @@ namespace Microsoft.DotNet.Tools.Restore
|
|||
{
|
||||
}
|
||||
|
||||
public static RestoreCommand FromArgs(string[] args, string msbuildPath = null)
|
||||
public static RestoreCommand FromArgs(string[] args, string msbuildPath = null, bool noLogo = true)
|
||||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
|
||||
|
@ -37,11 +37,6 @@ namespace Microsoft.DotNet.Tools.Restore
|
|||
"/t:Restore"
|
||||
};
|
||||
|
||||
if (!HasVerbosityOption(parsedRestore))
|
||||
{
|
||||
msbuildArgs.Add("/ConsoleLoggerParameters:Verbosity=Minimal");
|
||||
}
|
||||
|
||||
msbuildArgs.AddRange(parsedRestore.OptionValuesToBeForwarded());
|
||||
|
||||
msbuildArgs.AddRange(parsedRestore.Arguments);
|
||||
|
@ -65,12 +60,5 @@ namespace Microsoft.DotNet.Tools.Restore
|
|||
|
||||
return cmd.Execute();
|
||||
}
|
||||
|
||||
private static bool HasVerbosityOption(AppliedOption parsedRestore)
|
||||
{
|
||||
return parsedRestore.HasOption("verbosity") ||
|
||||
parsedRestore.Arguments.Any(a => a.Contains("/v:")) ||
|
||||
parsedRestore.Arguments.Any(a => a.Contains("/verbosity:"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,9 +13,6 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
|||
private const string ExpectedPrefix =
|
||||
"exec <msbuildpath> /m /v:m /NoLogo /t:Restore";
|
||||
|
||||
private string ExpectedPrefixWithConsoleLoggerParamaters =
|
||||
$"{ExpectedPrefix} /ConsoleLoggerParameters:Verbosity=Minimal";
|
||||
|
||||
[Theory]
|
||||
[InlineData(new string[] { }, "")]
|
||||
[InlineData(new string[] { "-s", "<source>" }, "/p:RestoreSources=<source>")]
|
||||
|
@ -30,19 +27,9 @@ namespace Microsoft.DotNet.Cli.MSBuild.Tests
|
|||
[InlineData(new string[] { "--no-cache" }, "/p:RestoreNoCache=true")]
|
||||
[InlineData(new string[] { "--ignore-failed-sources" }, "/p:RestoreIgnoreFailedSources=true")]
|
||||
[InlineData(new string[] { "--no-dependencies" }, "/p:RestoreRecursive=false")]
|
||||
public void MsbuildInvocationWithConsoleLoggerParametersIsCorrect(string[] args, string expectedAdditionalArgs)
|
||||
{
|
||||
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
|
||||
|
||||
var msbuildPath = "<msbuildpath>";
|
||||
RestoreCommand.FromArgs(args, msbuildPath)
|
||||
.GetProcessStartInfo().Arguments
|
||||
.Should().Be($"{ExpectedPrefixWithConsoleLoggerParamaters}{expectedAdditionalArgs}");
|
||||
}
|
||||
|
||||
[InlineData(new string[] { "-v", "minimal" }, @"/verbosity:minimal")]
|
||||
[InlineData(new string[] { "--verbosity", "minimal" }, @"/verbosity:minimal")]
|
||||
public void MsbuildInvocationWithVerbosityIsCorrect(string[] args, string expectedAdditionalArgs)
|
||||
public void MsbuildInvocationIsCorrect(string[] args, string expectedAdditionalArgs)
|
||||
{
|
||||
expectedAdditionalArgs = (string.IsNullOrEmpty(expectedAdditionalArgs) ? "" : $" {expectedAdditionalArgs}");
|
||||
|
||||
|
|
Loading…
Reference in a new issue