2016-10-14 00:06:35 -07: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.
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
public class DotNetRestoreProjectJson : DotNetTool
|
2016-10-14 00:06:35 -07:00
|
|
|
|
{
|
|
|
|
|
protected override string Command
|
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
get { return "restore-projectjson"; }
|
2016-10-14 00:06:35 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Args
|
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
get { return $"{GetVerbosity()} {GetFallbackSource()} {GetPackages()}"; }
|
2016-10-14 00:06:35 -07:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-27 18:46:43 -07:00
|
|
|
|
public string FallbackSource { get; set; }
|
2016-10-14 00:06:35 -07:00
|
|
|
|
|
|
|
|
|
public string Packages { get; set; }
|
|
|
|
|
|
2016-10-27 18:46:43 -07:00
|
|
|
|
public string Verbosity { get; set; }
|
2016-10-14 00:06:35 -07:00
|
|
|
|
|
2016-10-27 18:46:43 -07:00
|
|
|
|
private string GetFallbackSource()
|
2016-10-14 00:06:35 -07:00
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
if (!string.IsNullOrEmpty(FallbackSource))
|
2016-10-14 00:06:35 -07:00
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
return $"--fallbacksource {FallbackSource}";
|
2016-10-14 00:06:35 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetPackages()
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(Packages))
|
|
|
|
|
{
|
|
|
|
|
return $"--packages {Packages}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-27 18:46:43 -07:00
|
|
|
|
private string GetVerbosity()
|
2016-10-14 00:06:35 -07:00
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
if (!string.IsNullOrEmpty(Verbosity))
|
2016-10-14 00:06:35 -07:00
|
|
|
|
{
|
2016-10-27 18:46:43 -07:00
|
|
|
|
return $"--verbosity {Verbosity}";
|
2016-10-14 00:06:35 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|