2019-12-26 23:01:54 -05:00
// Copyright Epic Games, Inc. All Rights Reserved.
2018-11-26 16:46:35 -05:00
2018-09-15 12:58:49 -04:00
using System ;
using System.Collections.Generic ;
using System.Linq ;
using System.Text ;
using System.Threading.Tasks ;
2020-12-21 23:07:37 -04:00
using EpicGames.Core ;
2018-09-15 12:58:49 -04:00
namespace UnrealBuildTool
{
2018-12-08 11:31:03 -05:00
/// <summary>
/// Systems that need to be configured to execute a tool mode
/// </summary>
[Flags]
enum ToolModeOptions
{
/// <summary>
/// Do not initialize anything
/// </summary>
None = 0 ,
2018-12-23 20:29:48 -05:00
/// <summary>
/// Start prefetching metadata for the engine folder as early as possible
/// </summary>
StartPrefetchingEngine = 1 ,
2018-12-08 11:31:03 -05:00
/// <summary>
/// Initializes the XmlConfig system
/// </summary>
2018-12-23 20:29:48 -05:00
XmlConfig = 2 ,
2018-12-08 11:31:03 -05:00
/// <summary>
/// Registers build platforms
/// </summary>
2018-12-23 20:29:48 -05:00
BuildPlatforms = 4 ,
2018-12-08 11:31:03 -05:00
2019-08-12 11:21:45 -04:00
/// <summary>
/// Registers build platforms
/// </summary>
BuildPlatformsHostOnly = 8 ,
2018-12-08 11:31:03 -05:00
/// <summary>
/// Registers build platforms for validation
/// </summary>
2019-08-12 11:21:45 -04:00
BuildPlatformsForValidation = 16 ,
2018-12-08 11:31:03 -05:00
/// <summary>
/// Only allow a single instance running in the branch at once
/// </summary>
2019-08-12 11:21:45 -04:00
SingleInstance = 32 ,
2019-03-18 16:38:36 -04:00
/// <summary>
/// Print out the total time taken to execute
/// </summary>
2019-08-12 11:21:45 -04:00
ShowExecutionTime = 64 ,
2020-06-17 19:05:09 -04:00
/// <summary>
/// Capture logs as early as possible in a StartupTraceListener object
/// </summary>
UseStartupTraceListener = 128 ,
2018-12-08 11:31:03 -05:00
}
2018-09-15 12:58:49 -04:00
/// <summary>
/// Attribute used to specify options for a UBT mode.
/// </summary>
class ToolModeAttribute : Attribute
{
/// <summary>
/// Name of this mode
/// </summary>
public string Name ;
2018-12-08 11:31:03 -05:00
/// <summary>
/// Options for executing this mode
/// </summary>
public ToolModeOptions Options ;
2018-09-15 12:58:49 -04:00
/// <summary>
/// Constructor
/// </summary>
/// <param name="Name">Name of the mode</param>
2018-12-08 11:31:03 -05:00
/// <param name="Options">Options for this mode</param>
public ToolModeAttribute ( string Name , ToolModeOptions Options )
2018-09-15 12:58:49 -04:00
{
this . Name = Name ;
2018-12-08 11:31:03 -05:00
this . Options = Options ;
2018-09-15 12:58:49 -04:00
}
}
/// <summary>
/// Base class for standalone UBT modes. Different modes can be invoked using the -Mode=[Name] argument on the command line, where [Name] is determined by
/// the ToolModeAttribute on a ToolMode derived class. The log system will be initialized before calling the mode, but little else.
/// </summary>
abstract class ToolMode
{
/// <summary>
/// Entry point for this command.
/// </summary>
/// <param name="Arguments">List of command line arguments</param>
/// <returns>Exit code for the process</returns>
2018-09-16 13:19:23 -04:00
public abstract int Execute ( CommandLineArguments Arguments ) ;
2018-09-15 12:58:49 -04:00
}
}