// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using System;
using System.IO;
using System.Collections.Generic;
using System.Xml;
using System.Reflection;
namespace UnrealBuildTool
{
class BuildConfiguration
{
///
/// Whether to ignore import library files that are out of date when building targets. Set this to true to improve iteration time.
/// By default we don't bother relinking targets if only a dependent .lib has changed, as chances are that
/// the import library wasn't actually different unless a dependent header file of this target was also changed,
/// in which case the target would be rebuilt automatically.
///
[XmlConfigFile]
public bool bIgnoreOutdatedImportLibraries = true;
///
/// Whether to generate command line dependencies for compile actions when requested
///
[XmlConfigFile]
[CommandLine("-SkipActionHistory", Value = "false")]
public bool bUseActionHistory = true;
///
/// Whether debug info should be written to the console.
///
[XmlConfigFile]
public bool bPrintDebugInfo = false;
///
/// Allows logging to a file
///
[XmlConfigFile]
public string LogFilename;
///
/// Prints performance diagnostics about include dependencies and other bits
///
[XmlConfigFile]
public bool bPrintPerformanceInfo = false;
///
/// Whether to log detailed action stats. This forces local execution.
///
[XmlConfigFile]
public bool bLogDetailedActionStats = false;
///
/// Whether XGE may be used.
///
[XmlConfigFile]
[CommandLine("-NoXGE", Value = "false")]
public bool bAllowXGE = true;
///
/// Whether we should just export the XGE XML and pretend it succeeded
///
public bool bXGEExport;
///
/// Whether SN-DBS may be used.
///
[XmlConfigFile]
public bool bAllowSNDBS = true;
///
/// Whether or not to delete outdated produced items.
///
[XmlConfigFile]
public bool bShouldDeleteAllOutdatedProducedItems = false;
///
/// What level of logging we wish to show
///
[XmlConfigFile]
public string LogLevel = "Log";
///
/// Whether we should export a JSON file containing detailed target information.
///
[XmlConfigFile]
[CommandLine("-JsonExport")]
public string JsonExportFile = null;
///
/// Skip building; just do setup and terminate.
///
[CommandLine("-SkipBuild")]
public bool bSkipBuild = false;
///
/// Whether the dependency cache includes pre-resolved include locations so UBT doesn't have to re-resolve each include location just to check the timestamp.
/// This is technically not fully correct because the dependency cache is global and each module could have a different set of include paths that could cause headers
/// to resolve files differently. In practice this is not the case, and significantly speeds up UBT when nothing is to be done.
///
[XmlConfigFile]
public bool bUseIncludeDependencyResolveCache = true;
///
/// Used to test the dependency resolve cache. This will verify the resolve cache has no conflicts by resolving every time and checking against any previous resolve attempts.
///
[XmlConfigFile]
public bool bTestIncludeDependencyResolveCache = false;
///
/// Enables support for very fast iterative builds by caching target data. Turning this on causes Unreal Build Tool to emit
/// 'UBT Makefiles' for targets when they're built the first time. Subsequent builds will load these Makefiles and begin
/// outdatedness checking and build invocation very quickly. The caveat is that if source files are added or removed to
/// the project, UBT will need to gather information about those in order for your build to complete successfully. Currently,
/// you must run the project file generator after adding/removing source files to tell UBT to re-gather this information.
///
/// Events that can invalidate the 'UBT Makefile':
/// - Adding/removing .cpp files
/// - Adding/removing .h files with UObjects
/// - Adding new UObject types to a file that didn't previously have any
/// - Changing global build settings (most settings in this file qualify.)
/// - Changed code that affects how Unreal Header Tool works
///
/// You can force regeneration of the 'UBT Makefile' by passing the '-gather' argument, or simply regenerating project files
///
/// This also enables the fast include file dependency scanning and caching system that allows Unreal Build Tool to detect out
/// of date dependencies very quickly. When enabled, a deep C++ include graph does not have to be generated, and instead
/// we only scan and cache indirect includes for after a dependent build product was already found to be out of date. During the
/// next build, we'll load those cached indirect includes and check for outdatedness.
///
[XmlConfigFile]
[CommandLine("-NoUBTMakefiles", Value = "false")]
public bool bUseUBTMakefiles = true;
///
/// Enables support for fast UHT parsing by caching results of previous UHT runs. If a module or *.uhtmanifest
/// gets changed, all modules up to first changed one get loaded from makefile and the rest is parsed regularly.
/// This feature is new and can have issues that weren't discovered in isolated testing so disabling by default.
///
[XmlConfigFile]
[CommandLine("-UHTMakefiles")]
public bool bUseUHTMakefiles = false;
///
/// Whether DMUCS/Distcc may be used.
/// Distcc requires some setup - so by default disable it so we don't break local or remote building
///
[XmlConfigFile]
public bool bAllowDistcc = false;
///
/// If specified, we will only build this particular source file, ignore all other outputs. Useful for testing non-Unity builds.
///
public string SingleFileToCompile = null;
///
/// Whether to skip checking for files identified by the junk manifest
///
[XmlConfigFile]
public bool bIgnoreJunk = false;
///
/// Whether to generate a manifest file that contains the files to add to Perforce
///
[CommandLine("-GenerateManifest")]
public bool bGenerateManifest = false;
///
/// Whether to 'clean' the given project
///
[CommandLine("-Clean")]
public bool bCleanProject = false;
///
/// If we are just running the deployment step, specifies the path to the given deployment settings
///
[CommandLine("-Deploy")]
public FileReference DeployTargetFile = null;
///
/// If true, force header regeneration. Intended for the build machine
///
[CommandLine("-ForceHeaderGeneration")]
[XmlConfigFile(Category = "UEBuildConfiguration")]
public bool bForceHeaderGeneration = false;
///
/// If true, do not build UHT, assume it is already built
///
[CommandLine("-NoBuildUHT")]
[XmlConfigFile(Category = "UEBuildConfiguration")]
public bool bDoNotBuildUHT = false;
///
/// If true, fail if any of the generated header files is out of date.
///
[CommandLine("-FailIfGeneratedCodeChanges")]
[XmlConfigFile(Category = "UEBuildConfiguration")]
public bool bFailIfGeneratedCodeChanges = false;
///
/// True if hot-reload from IDE is allowed
///
[XmlConfigFile(Category = "UEBuildConfiguration")]
[ConfigFile(ConfigHierarchyType.Engine, "BuildConfiguration")]
public bool bAllowHotReloadFromIDE = true;
///
/// If true, the Debug version of UnrealHeaderTool will be build and run instead of the Development version.
///
[XmlConfigFile(Category = "UEBuildConfiguration")]
public static bool bForceDebugUnrealHeaderTool = false;
///
/// True if performing hot-reload from IDE
///
public bool bHotReloadFromIDE = false;
///
/// When true, the targets won't execute their link actions if there was nothing to compile
///
[CommandLine("-CanSkipLink")]
public bool bSkipLinkingWhenNothingToCompile = false;
///
/// Default constructor. Reads settings from the XmlConfig files.
///
public BuildConfiguration()
{
XmlConfig.ApplyTo(this);
}
}
}