using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutomationTool;
using UnrealBuildTool;
using System.Xml;
namespace BuildGraph.Tasks
{
///
/// Parameters for a task which calls another UAT command
///
public class CommandTaskParameters
{
///
/// The command name to execute
///
[TaskParameter]
public string Name;
///
/// Arguments to be passed to the command
///
[TaskParameter(Optional = true)]
public string Arguments;
}
///
/// Implements a task which calls another UAT command
///
[TaskElement("Command", typeof(CommandTaskParameters))]
public class CommandTask : CustomTask
{
///
/// Parameters for this task
///
CommandTaskParameters Parameters;
///
/// Construct a new CommandTask.
///
/// Parameters for this task
public CommandTask(CommandTaskParameters 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)
{
CommandUtils.RunUAT(CommandUtils.CmdEnv, String.Format("{0} {1}", Parameters.Name, Parameters.Arguments ?? ""));
return true;
}
///
/// Output this task out to an XML writer.
///
public override void Write(XmlWriter Writer)
{
Write(Writer, Parameters);
}
}
}