2016-10-27 18:46:43 -07:00
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
2015-12-14 17:39:29 -08:00
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
|
|
|
|
using Microsoft.DotNet.Cli.Utils;
|
|
|
|
|
2015-12-30 17:02:59 -08:00
|
|
|
namespace Microsoft.DotNet.Tools.Test.Utilities
|
2015-12-14 17:39:29 -08:00
|
|
|
{
|
2017-03-14 14:07:51 -07:00
|
|
|
public sealed class RestoreCommand : DotnetCommand
|
2015-12-14 17:39:29 -08:00
|
|
|
{
|
2016-10-31 16:22:10 -07:00
|
|
|
private string _runtime;
|
|
|
|
|
|
|
|
public RestoreCommand WithRuntime(string runtime)
|
|
|
|
{
|
|
|
|
_runtime = runtime;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2016-10-27 18:46:43 -07:00
|
|
|
public override CommandResult Execute(string args = "")
|
2015-12-14 17:39:29 -08:00
|
|
|
{
|
2016-10-31 16:22:10 -07:00
|
|
|
args = $"restore {GetRuntime()} {args} --disable-parallel";
|
2015-12-14 17:39:29 -08:00
|
|
|
return base.Execute(args);
|
|
|
|
}
|
2016-06-06 16:23:23 -07:00
|
|
|
|
|
|
|
public override CommandResult ExecuteWithCapturedOutput(string args = "")
|
|
|
|
{
|
2016-10-31 16:22:10 -07:00
|
|
|
args = $"restore {GetRuntime()} {args} --disable-parallel";
|
2016-06-06 16:23:23 -07:00
|
|
|
return base.ExecuteWithCapturedOutput(args);
|
|
|
|
}
|
2016-10-31 16:22:10 -07:00
|
|
|
|
|
|
|
private string GetRuntime()
|
|
|
|
{
|
|
|
|
if (_runtime == null)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-04-02 15:14:32 -07:00
|
|
|
return $"-property:RuntimeIdentifier={_runtime}";
|
2016-10-31 16:22:10 -07:00
|
|
|
}
|
2015-12-14 17:39:29 -08:00
|
|
|
}
|
|
|
|
}
|