Fixing a bug in the restore option where specifying verbosity through /v was not entirely honored.

Adding tests for implicit restore for all the affected commands.

Fixing an issue where the command target was being passed to the restore command during implicit restore.

Adding restore params to all commands with implicit restore. Also, implicitly set the restore output to quiet.

Adding tests for the no-restore option.
This commit is contained in:
Livar Cunha 2017-06-02 23:32:53 -07:00
commit 3231295acf
14 changed files with 475 additions and 179 deletions

View file

@ -14,6 +14,27 @@ namespace Microsoft.DotNet.Tools
private IEnumerable<string> ArgsToForward { get; }
private IEnumerable<string> ArgsToForwardToRestore
{
get
{
var restoreArguments = ArgsToForward.Where(a =>
!a.StartsWith("/t:") &&
!a.StartsWith("/target:") &&
!a.StartsWith("/ConsoleLoggerParameters:") &&
!a.StartsWith("/clp:"));
if (!restoreArguments.Any(a => a.StartsWith("/v:") || a.StartsWith("/verbosity:")))
{
restoreArguments = restoreArguments.Concat(new string[] { "/v:q" });
}
return restoreArguments;
}
}
private bool ShouldRunImplicitRestore => !NoRestore;
public RestoringCommand(IEnumerable<string> msbuildArgs, bool noRestore, string msbuildPath = null)
: base(msbuildArgs, msbuildPath)
{
@ -25,7 +46,7 @@ namespace Microsoft.DotNet.Tools
{
if (ShouldRunImplicitRestore)
{
int exitCode = RestoreCommand.Run(ArgsToForward.ToArray());
int exitCode = RestoreCommand.Run(ArgsToForwardToRestore.ToArray());
if (exitCode != 0)
{
return exitCode;
@ -34,7 +55,5 @@ namespace Microsoft.DotNet.Tools
return base.Execute();
}
private bool ShouldRunImplicitRestore => !NoRestore;
}
}