Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/BuildGraph/Tasks/CommandTask.cs
Ben Marsh 6af6c038ea Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 2982165)
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2963214 on 2016/05/02 by Ben.Marsh

	BuildGraph: Allow specifying optional dependencies for a node, indicating that the build products from an upstream node are desired, but should not block the node from running.

Change 2972295 on 2016/05/10 by Ben.Marsh

	EC: Remove spacing in notification emails to reduce size, and help prevent gmail from truncating messages. Also allow mailing notification emails when doing a dry run, and reading stream settings from another branch.

Change 2976096 on 2016/05/12 by Ben.Marsh

	EC: Store properties for the last succeeded builds, including the list of users that were notified about it.

Change 2976390 on 2016/05/12 by Ben.Marsh

	EC: Add a separate line to the notification email summary with a link to edit settings, and pass the missing ec-update parameter to set the last build status.

Change 2976441 on 2016/05/12 by Ben.Marsh

	UAT: Remove log file copy on builders after UAT failure. This is done outside the EC step that originally did it now.

Change 2976456 on 2016/05/12 by Ben.Marsh

	BuildGraph: Catch exceptions thrown by child processes failing when building or running UAT commands, and return failure normally without dumping callstacks.

Change 2978440 on 2016/05/16 by Ben.Marsh

	EC: Age out entries from the "latest builds" list after a week. There's no obvious way to tell if a node has been removed, but a periodic cleanup should keep the build notifications list in check.

Change 2979446 on 2016/05/16 by Ben.Marsh

	Rename ambiguous headers which exist with the same name in different paths.

Change 2979839 on 2016/05/16 by Ben.Marsh

	UE4: Renaming HTML5 SocketSubsystem files to eliminate ambiguities.

Change 2979852 on 2016/05/16 by Ben.Marsh

	UE4: Use explicit relative paths for public headers in PortalServiceInterfaces modules which do not have unique names

Change 2980113 on 2016/05/17 by Ben.Marsh

	UE4: Fix include paths for HTML5 SocketSubsystem files.

Change 2980117 on 2016/05/17 by Ben.Marsh

	UE4: Remove reference to private PCH from Oculus common code.

Change 2980186 on 2016/05/17 by Ben.Marsh

	UAT: Add a -StopOnErrors parameter to UE4Build, which is propagated to XGE.

Change 2980879 on 2016/05/17 by Ben.Marsh

	UE4: Fixup Lightmass to use LightmassPCH.h rather than stdafx.h

Change 2981117 on 2016/05/17 by Ben.Marsh

	Portal: Use a unique name for the Portal PCH, rather than just calling it PrivatePCH.h

Change 2981839 on 2016/05/18 by Ben.Marsh

	Replace ambiguous D3D11/D3D12 includes with direct includes for the current platform.

#lockdown Nick.Penwarden

[CL 2982178 by Ben Marsh in Main branch]
2016-05-18 13:26:45 -04:00

114 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutomationTool;
using UnrealBuildTool;
using System.Xml;
using System.IO;
namespace BuildGraph.Tasks
{
/// <summary>
/// Parameters for a task which calls another UAT command
/// </summary>
public class CommandTaskParameters
{
/// <summary>
/// The command name to execute
/// </summary>
[TaskParameter]
public string Name;
/// <summary>
/// Arguments to be passed to the command
/// </summary>
[TaskParameter(Optional = true)]
public string Arguments;
/// <summary>
/// If non-null, instructs telemetry from the command to be merged into the telemetry for this UAT instance with the given prefix. May be an empty (non-null) string.
/// </summary>
[TaskParameter(Optional = true)]
public string MergeTelemetryWithPrefix;
}
/// <summary>
/// Implements a task which calls another UAT command
/// </summary>
[TaskElement("Command", typeof(CommandTaskParameters))]
public class CommandTask : CustomTask
{
/// <summary>
/// Parameters for this task
/// </summary>
CommandTaskParameters Parameters;
/// <summary>
/// Construct a new CommandTask.
/// </summary>
/// <param name="InParameters">Parameters for this task</param>
public CommandTask(CommandTaskParameters InParameters)
{
Parameters = InParameters;
}
/// <summary>
/// Execute the task.
/// </summary>
/// <param name="Job">Information about the current job</param>
/// <param name="BuildProducts">Set of build products produced by this node.</param>
/// <param name="TagNameToFileSet">Mapping from tag names to the set of files they include</param>
/// <returns>True if the task succeeded</returns>
public override bool Execute(JobContext Job, HashSet<FileReference> BuildProducts, Dictionary<string, HashSet<FileReference>> TagNameToFileSet)
{
// If we're merging telemetry from the child process, get a temp filename for it
FileReference TelemetryFile = null;
if (Parameters.MergeTelemetryWithPrefix != null)
{
TelemetryFile = FileReference.Combine(CommandUtils.RootDirectory, "Engine", "Intermediate", "UAT", "Telemetry.json");
TelemetryFile.Directory.CreateDirectory();
}
// Run the command
string CommandLine = Parameters.Name;
if (!String.IsNullOrEmpty(Parameters.Arguments))
{
CommandLine += String.Format(" {0}", Parameters.Arguments);
}
if(TelemetryFile != null)
{
CommandLine += String.Format(" -Telemetry={0}", CommandUtils.MakePathSafeToUseWithCommandLine(TelemetryFile.FullName));
}
try
{
CommandUtils.RunUAT(CommandUtils.CmdEnv, CommandLine);
}
catch(CommandUtils.CommandFailedException)
{
return false;
}
// Merge in any new telemetry data that was produced
if (Parameters.MergeTelemetryWithPrefix != null)
{
TelemetryData NewTelemetry;
if (TelemetryData.TryRead(TelemetryFile.FullName, out NewTelemetry))
{
CommandUtils.Telemetry.Merge(Parameters.MergeTelemetryWithPrefix, NewTelemetry);
}
}
return true;
}
/// <summary>
/// Output this task out to an XML writer.
/// </summary>
public override void Write(XmlWriter Writer)
{
Write(Writer, Parameters);
}
}
}