dotnet-installer/build_projects/dotnet-cli-build/DotNetPack.cs
Piotr Puszkiewicz 16bedef2c5 Piotrp msft/msbuild/incremental test (#3842)
* Incremental Testing - Part 1

* Fix 'clean' bug

* Remove --fallbacksource from TestAssetPackage restore.
2016-07-12 17:10:48 -07:00

90 lines
2 KiB
C#

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Microsoft.DotNet.Cli.Build
{
public class DotNetPack : DotNetTool
{
protected override string Command
{
get { return "pack"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()}"; }
}
public string Configuration { get; set; }
public bool NoBuild { get; set; }
public string BuildBasePath { get; set; }
public string Output { get; set; }
public string ProjectPath { get; set; }
public string VersionSuffix { get; set; }
private string GetConfiguration()
{
if (!string.IsNullOrEmpty(Configuration))
{
return $"--configuration {Configuration}";
}
return null;
}
private string GetNoBuild()
{
if (NoBuild)
{
return $"--no-build";
}
return null;
}
private string GetBuildBasePath()
{
if (!string.IsNullOrEmpty(BuildBasePath))
{
return $"--build-base-path {BuildBasePath}";
}
return null;
}
private string GetOutput()
{
if (!string.IsNullOrEmpty(Output))
{
return $"--output {Output}";
}
return null;
}
private string GetProjectPath()
{
if (!string.IsNullOrEmpty(ProjectPath))
{
return $"{ProjectPath}";
}
return null;
}
private string GetVersionSuffix()
{
if (!string.IsNullOrEmpty(VersionSuffix))
{
return $"--version-suffix {VersionSuffix}";
}
return null;
}
}
}