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