2016-07-15 15:31:50 +00:00
|
|
|
|
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
|
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
2016-07-13 00:10:48 +00:00
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
|
|
|
{
|
|
|
|
|
public class DotNetRestore : DotNetTool
|
|
|
|
|
{
|
|
|
|
|
protected override string Command
|
|
|
|
|
{
|
|
|
|
|
get { return "restore"; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Args
|
|
|
|
|
{
|
2016-10-27 04:34:27 +00:00
|
|
|
|
get { return $"{GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetDisableParallel()}"; }
|
2016-07-13 00:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
|
public string Source { get; set; }
|
2016-07-13 00:10:48 +00:00
|
|
|
|
|
2016-07-26 04:29:59 +00:00
|
|
|
|
public string Packages { get; set; }
|
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
|
public bool SkipInvalidConfigurations { get; set; }
|
2016-07-13 00:10:48 +00:00
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
|
private string GetSource()
|
2016-07-13 00:10:48 +00:00
|
|
|
|
{
|
2016-10-28 01:46:43 +00:00
|
|
|
|
if (!string.IsNullOrEmpty(Source))
|
2016-07-13 00:10:48 +00:00
|
|
|
|
{
|
2016-10-28 01:46:43 +00:00
|
|
|
|
return $"--source {Source}";
|
2016-07-13 00:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-26 04:29:59 +00:00
|
|
|
|
private string GetPackages()
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(Packages))
|
|
|
|
|
{
|
|
|
|
|
return $"--packages {Packages}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-28 01:46:43 +00:00
|
|
|
|
private string GetSkipInvalidConfigurations()
|
2016-07-13 00:10:48 +00:00
|
|
|
|
{
|
2016-10-28 01:46:43 +00:00
|
|
|
|
if (SkipInvalidConfigurations)
|
2016-07-13 00:10:48 +00:00
|
|
|
|
{
|
2016-10-28 01:46:43 +00:00
|
|
|
|
return "/p:SkipInvalidConfigurations=true";
|
2016-07-13 00:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
2016-10-27 04:34:27 +00:00
|
|
|
|
|
|
|
|
|
private string GetDisableParallel()
|
|
|
|
|
{
|
|
|
|
|
return "--disable-parallel";
|
|
|
|
|
}
|
2016-07-13 00:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|