using AutomationTool;
using EpicGames.MCP.Automation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using UnrealBuildTool;
namespace AutomationTool.Tasks
{
///
/// Parameters to label a given build in the MCP backend
///
public class LabelBuildTaskParameters
{
///
/// The application name
///
[TaskParameter]
public string AppName;
///
/// The application id
///
[TaskParameter(Optional = true)]
public int AppID = 1;
///
/// Unique build version of the app.
///
[TaskParameter]
public string BuildVersion;
///
/// Platform we are posting info for.
///
[TaskParameter]
public MCPPlatform Platform;
///
/// The label(s) to apply to this build.
///
[TaskParameter]
public string Label;
///
/// The MCP configuration name.
///
[TaskParameter]
public string McpConfig;
}
///
/// Implements a task which labels a given build in the MCP backend
///
[TaskElement("LabelBuild", typeof(LabelBuildTaskParameters))]
public class LabelBuildTask : CustomTask
{
///
/// Parameters for this task
///
LabelBuildTaskParameters Parameters;
///
/// Construct a new LabelBuildTask.
///
/// Parameters for this task
public LabelBuildTask(LabelBuildTaskParameters InParameters)
{
Parameters = InParameters;
}
///
/// Execute the task.
///
/// Information about the current job
/// Set of build products produced by this node.
/// Mapping from tag names to the set of files they include
/// True if the task succeeded
public override bool Execute(JobContext Job, HashSet BuildProducts, Dictionary> TagNameToFileSet)
{
BuildPatchToolStagingInfo StagingInfo = new BuildPatchToolStagingInfo(Job.OwnerCommand, Parameters.AppName, Parameters.AppID, Parameters.BuildVersion, Parameters.Platform, null, null);
foreach (string Label in SplitDelimitedList(Parameters.Label))
{
string LabelWithPlatform = BuildInfoPublisherBase.Get().GetLabelWithPlatform(Label, Parameters.Platform);
BuildInfoPublisherBase.Get().LabelBuild(StagingInfo, LabelWithPlatform, Parameters.McpConfig);
}
return true;
}
///
/// Output this task out to an XML writer.
///
public override void Write(XmlWriter Writer)
{
Write(Writer, Parameters);
}
///
/// Find all the tags which are used as inputs to this task
///
/// The tag names which are read by this task
public override IEnumerable FindConsumedTagNames()
{
yield break;
}
///
/// Find all the tags which are modified by this task
///
/// The tag names which are modified by this task
public override IEnumerable FindProducedTagNames()
{
yield break;
}
}
}