5ebc6a1ceb
* Eliminate CleanPublishOutput * Decompose Crossgen Task * WiP * TarGzFileExtractToDirectory * FixModeFlags --> CHMod Also various eliminations of dead code * Tasks cleanup Move all tasks to .tasks file. There is little value in keepint them in each source file as they are already being used assumptively by files that happen to get executed later. Also eliminating uses of <Exec> for DotNet invocations * Move to BuildTools implementation of TarGzCreateFromDirectory * Eliminate Command.cs and helpers * Remove dead code * Revert TarGz from BuildTools Latest build tools package has not picked up the task, though it is checked in. * Disable ChMod on Windows * Windows bug fix * PR Feedback * Finish changing Chmod caps
102 lines
2.4 KiB
C#
102 lines
2.4 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 DotNetPublish : DotNetTool
|
|
{
|
|
protected override string Command
|
|
{
|
|
get { return "publish"; }
|
|
}
|
|
|
|
protected override string Args
|
|
{
|
|
get { return $"{GetProjectPath()} {GetConfiguration()} {GetFramework()} {GetNativeSubdirectory()} {GetBuildBasePath()} {GetOutput()} {GetVersionSuffix()}"; }
|
|
}
|
|
|
|
public string BuildBasePath { get; set; }
|
|
|
|
public string Configuration { get; set; }
|
|
|
|
public string Framework { get; set; }
|
|
|
|
public bool NativeSubDirectory { get; set; }
|
|
|
|
public string Output { get; set; }
|
|
|
|
public string ProjectPath { get; set; }
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|