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 DotNetPack : DotNetTool
|
|
|
|
{
|
|
|
|
protected override string Command
|
|
|
|
{
|
|
|
|
get { return "pack"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override string Args
|
|
|
|
{
|
2016-11-15 22:12:28 +00:00
|
|
|
get { return $"{GetProjectPath()} {GetConfiguration()} {GetNoBuild()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {MsbuildArgs}"; }
|
2016-07-13 00:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string Configuration { get; set; }
|
|
|
|
|
|
|
|
public bool NoBuild { get; set; }
|
2016-11-15 22:12:28 +00:00
|
|
|
|
|
|
|
public string MsbuildArgs { get; set; }
|
|
|
|
|
2016-07-13 00:10:48 +00:00
|
|
|
public string Output { get; set; }
|
|
|
|
|
|
|
|
public string ProjectPath { get; set; }
|
|
|
|
|
|
|
|
public string VersionSuffix { get; set; }
|
2016-11-14 22:26:03 +00:00
|
|
|
|
|
|
|
public string Runtime { get; set; }
|
2016-07-13 00:10:48 +00:00
|
|
|
|
|
|
|
private string GetConfiguration()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(Configuration))
|
|
|
|
{
|
|
|
|
return $"--configuration {Configuration}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private string GetNoBuild()
|
|
|
|
{
|
|
|
|
if (NoBuild)
|
|
|
|
{
|
|
|
|
return $"--no-build";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2016-11-03 06:01:57 +00:00
|
|
|
|
2016-07-13 00:10:48 +00:00
|
|
|
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;
|
|
|
|
}
|
2016-11-14 22:26:03 +00:00
|
|
|
|
|
|
|
private string GetRuntime()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(Runtime))
|
|
|
|
{
|
|
|
|
return $"/p:RuntimeIdentifier={Runtime}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
2016-07-13 00:10:48 +00:00
|
|
|
}
|
|
|
|
}
|