dotnet-installer/build_projects/dotnet-cli-build/DotNetPack.cs
Justin Goshi 51562109ea Migrate test packages (#4720)
* Migrate TestPackages

* Add check for desktop available

* Revert previous change

* WIP try something for non-Windows

* Another attempt to pack properly on non-windows

* Another attempt to fix pack errors

* Remove spaces

* Another attempt to make pack work cross-platform
2016-11-15 12:12:28 -10:00

92 lines
2.1 KiB
C#

// 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
{
public class DotNetPack : DotNetTool
{
protected override string Command
{
get { return "pack"; }
}
protected override string Args
{
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {MsbuildArgs}"; }
}
public string Configuration { get; set; }
public bool NoBuild { get; set; }
public string MsbuildArgs { get; set; }
public string Output { get; set; }
public string ProjectPath { get; set; }
public string VersionSuffix { get; set; }
public string Runtime { 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 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;
}
private string GetRuntime()
{
if (!string.IsNullOrEmpty(Runtime))
{
return $"/p:RuntimeIdentifier={Runtime}";
}
return null;
}
}
}