Files
UnrealEngineUWP/Engine/Source/Programs/AutomationTool/AutomationUtils/BuildCommand.cs
Wes Hunt 506f7e64a4 UEB-260 - Break AutomationTool into AutomationUtils that all automation projects depend on, and AutomationTool, which essentially only contains the startup code.
* Remove ErrorReporter.Error, replace with AutomationException with Error Code.
* Move ErrorCodes to AutomationException.
* Don't return exit codes. Solely rely on exceptions to propagate exit codes.
* Remove MainProc delegate
* Remove setting of Environment.ExitCode as it is ignored when main returns an int.
* ShutdownLogging is nothrow, as all exceptions would be ignored anyway.
* Wrap all shutdown steps so further ones get a chance to run.
* Move HostPlatform.Initialize into the global try/catch block
#codereview:ben.marsh

[CL 2605826 by Wes Hunt in Main branch]
2015-06-30 11:40:05 -04:00

55 lines
1.0 KiB
C#

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutomationTool;
/// <summary>
/// Base class for buildcommands.
/// </summary>
public abstract class BuildCommand : CommandUtils
{
#region Interface
/// <summary>
/// Build command entry point. Throws AutomationExceptions on failure.
/// </summary>
public abstract void ExecuteBuild();
#endregion
/// <summary>
/// Command entry point.
/// </summary>
public void Execute()
{
try
{
ExecuteBuild();
}
catch
{
LogError("BUILD FAILED");
throw;
}
Log("BUILD SUCCESSFUL");
}
/// <summary>
/// Executes a new command as a child of another command.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="ParentCommand"></param>
public static void Execute<T>(BuildCommand ParentCommand) where T : BuildCommand, new()
{
T Command = new T();
if (ParentCommand != null)
{
Command.Params = ParentCommand.Params;
}
Command.Execute();
}
}