2016-07-26 04:29:59 +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.
|
|
|
|
|
|
|
|
namespace Microsoft.DotNet.Cli.Build
|
|
|
|
{
|
2017-01-28 01:13:04 +00:00
|
|
|
public class DotNetPublish : DotNetMSBuildTool
|
2016-07-26 04:29:59 +00:00
|
|
|
{
|
|
|
|
protected override string Command
|
|
|
|
{
|
|
|
|
get { return "publish"; }
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override string Args
|
|
|
|
{
|
2017-01-28 01:13:04 +00:00
|
|
|
get { return $"{base.Args} {GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()} {GetRuntime()} {GetMSBuildArgs()}"; }
|
2016-07-26 04:29:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public string BuildBasePath { get; set; }
|
|
|
|
|
|
|
|
public string Configuration { get; set; }
|
|
|
|
|
|
|
|
public string Framework { get; set; }
|
|
|
|
|
|
|
|
public bool NativeSubDirectory { get; set; }
|
|
|
|
|
2016-10-29 08:04:20 +00:00
|
|
|
public string MSBuildArgs { get; set; }
|
|
|
|
|
2016-07-26 04:29:59 +00:00
|
|
|
public string Output { get; set; }
|
|
|
|
|
|
|
|
public string ProjectPath { get; set; }
|
|
|
|
|
2016-10-29 08:04:20 +00:00
|
|
|
public string Runtime { get; set; }
|
|
|
|
|
2016-07-26 04:29:59 +00:00
|
|
|
public string VersionSuffix { get; set; }
|
|
|
|
|
|
|
|
private string GetBuildBasePath()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(BuildBasePath))
|
|
|
|
{
|
|
|
|
return $"--build-base-path {BuildBasePath}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private string GetConfiguration()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(Configuration))
|
|
|
|
{
|
|
|
|
return $"--configuration {Configuration}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private string GetFramework()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(Framework))
|
|
|
|
{
|
|
|
|
return $"--framework {Framework}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private string GetNativeSubdirectory()
|
|
|
|
{
|
|
|
|
if (NativeSubDirectory)
|
|
|
|
{
|
|
|
|
return $"--native-subdirectory";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-10-29 08:04:20 +00:00
|
|
|
private string GetMSBuildArgs()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(MSBuildArgs))
|
|
|
|
{
|
2017-01-04 22:18:44 +00:00
|
|
|
return $"{MSBuildArgs}";
|
2016-10-29 08:04:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-07-26 04:29:59 +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;
|
|
|
|
}
|
|
|
|
|
2016-10-29 08:04:20 +00:00
|
|
|
private string GetRuntime()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(Runtime))
|
|
|
|
{
|
|
|
|
return $"--runtime {Runtime}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-07-26 04:29:59 +00:00
|
|
|
private string GetVersionSuffix()
|
|
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(VersionSuffix))
|
|
|
|
{
|
|
|
|
return $"--version-suffix {VersionSuffix}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|