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 BuildGraph.Tasks
{
///
/// Parameters to posts build information to the MCP backend
///
public class PostBuildTaskParameters
{
///
/// The application name
///
[TaskParameter]
public string AppName;
///
/// Unique build version of the app.
///
[TaskParameter]
public string BuildVersion;
///
/// Platform we are posting info for.
///
[TaskParameter]
public MCPPlatform Platform;
///
/// Path to the directory containing chunks and manifests
///
[TaskParameter]
public string CloudDir;
///
/// The MCP configuration name.
///
[TaskParameter]
public string McpConfig;
}
///
/// Implements a task which posts build information to the MCP backend
///
[TaskElement("PostBuild", typeof(PostBuildTaskParameters))]
public class PostBuildTask : CustomTask
{
///
/// Parameters for this task
///
PostBuildTaskParameters Parameters;
///
/// Construct a new PostBuildTask.
///
/// Parameters for this task
public PostBuildTask(PostBuildTaskParameters 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)
{
DirectoryReference CloudDir = new DirectoryReference(Parameters.CloudDir);
BuildPatchToolStagingInfo StagingInfo = new BuildPatchToolStagingInfo(Job.OwnerCommand, Parameters.AppName, 1, Parameters.BuildVersion, Parameters.Platform, null, CloudDir);
BuildInfoPublisherBase.Get().PostBuildInfo(StagingInfo, 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;
}
}
}