Files
UnrealEngineUWP/Engine/Source/Programs/UnrealBuildTool/System/FileItem.cs

488 lines
14 KiB
C#
Raw Normal View History

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Threading;
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
using System.Runtime.Serialization;
namespace UnrealBuildTool
{
/**
* Represents a file on disk that is used as an input or output of a build action.
* FileItems are created by calling FileItem.GetItemByPath, which creates a single FileItem for each unique file path.
*/
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
[Serializable]
public class FileItem : ISerializable
{
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
///
/// Preparation and Assembly (serialized)
///
/** The action that produces the file. */
public Action ProducingAction = null;
/** The absolute path of the file. */
public readonly string AbsolutePath;
/** True if any DLLs produced by this */
public bool bNeedsHotReloadNumbersDLLCleanUp = false;
/** Whether or not this is a remote file, in which case we can't access it directly */
public bool bIsRemoteFile = false;
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
/** For C++ file items, this stores cached information about the include paths needed in order to include header files from these C++ files. This is part of UBT's dependency caching optimizations. */
public CPPIncludeInfo CachedCPPIncludeInfo
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
{
get
{
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
return _CachedCPPIncludeInfo;
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
}
set
{
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
if( value != null && _CachedCPPIncludeInfo != null && _CachedCPPIncludeInfo != value )
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
{
// Uh oh. We're clobbering our cached CompileEnvironment for this file with a different CompileEnvironment. This means
// that the same source file is being compiled into more than one module. (e.g. PCLaunch.rc)
// @todo ubtmake: The only expected offender here is PCLaunch.rc and friends, which are injected by UBT into every module when not compiling monolithic.
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
// PCLaunch.rc and ModuleVersionResource.rc.inl are "safe" because they do not include any headers that would be affected by include path order.
// ==> Ideally we would use a different "shared" CompileEnvironment for these injected .rc files, so their include paths would not change
// ==> OR, we can make an Intermediate copy of the .rc file for each module (easier)
if( !AbsolutePath.EndsWith( "PCLaunch.rc", StringComparison.InvariantCultureIgnoreCase ) &&
!AbsolutePath.EndsWith( "ModuleVersionResource.rc.inl", StringComparison.InvariantCultureIgnoreCase ) )
{
// Let's make sure the include paths are the same
// @todo ubtmake: We have not seen examples of this actually firing off, so we could probably remove the check for matching includes and simply always make this an error case
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
var CachedIncludePathsToSearch = _CachedCPPIncludeInfo.GetIncludesPathsToSearch( this );
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
var NewIncludePathsToSearch = value.GetIncludesPathsToSearch( this );
bool bIncludesAreDifferent = false;
if( CachedIncludePathsToSearch.Count != NewIncludePathsToSearch.Count )
{
bIncludesAreDifferent = true;
}
else
{
for( var IncludeIndex = 0; IncludeIndex < CachedIncludePathsToSearch.Count; ++IncludeIndex )
{
if( !CachedIncludePathsToSearch[ IncludeIndex ].Equals( NewIncludePathsToSearch[ IncludeIndex ], StringComparison.InvariantCultureIgnoreCase ) )
{
bIncludesAreDifferent = true;
break;
}
}
}
if( bIncludesAreDifferent )
{
throw new BuildException( "File '{0}' was included by multiple modules, but with different include paths", this.Info.FullName );
}
}
}
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
_CachedCPPIncludeInfo = value;
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
}
}
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
public CPPIncludeInfo _CachedCPPIncludeInfo;
///
/// Preparation only (not serialized)
///
/** PCH header file name as it appears in an #include statement in source code (might include partial, or no relative path.)
This is needed by some compilers to use PCH features. */
public string PCHHeaderNameInCode;
/** The PCH file that this file will use */
public string PrecompiledHeaderIncludeFilename;
///
/// Transients (not serialized)
///
/** The information about the file. */
public FileInfo Info;
/** This is true if this item is actually a directory. Consideration for Mac application bundles. Note that Info will be null if true! */
public bool IsDirectory;
/** Relative cost of action associated with producing this file. */
public long RelativeCost = 0;
UnrealBuildTool: Experimental fast C++ include dependency scanning - Adds experimental super-fast C++ outdated file checking - This feature is turned off for now as we continue to test and improve it - You can try it out by enabling "bUseExperimentalFastDependencyScan" option in your BuildConfiguration.xml - Here is the basic idea: - We no longer exhaustively scan all includes and build up a big graph every invocation - Instead, source files whose build products are missing have their includes scanned asynchronously while being compiled - The flat list of dependent includes for every outdated C++ is saved into a new cache file ("FlatCPPIncludes.bin") - On the next run, we quickly load that up and "just know" which files to check timestamps on to determine what is out of date - Lots of "@todo fastubt" comments were added to UnrealBuildTool for potential performance optimizations and further improvements on this feature. UnrealBuildTool: Determination of which modules have UObjects is now faster - We now cache which modules have UObjects and load those for the next session UnrealBuildTool: Module "shared" precompiled header determination is now much faster - We no longer scan all C++ includes for a module to figure out which "shared" PCH to use - Instead, we use the module dependencies specified in the module's *.Build.cs file - For example, if your module depends on "Engine" and "UnrealEd", we choose "UnrealEd"'s shared PCH Other UBT optimizations: - Reduced calls to string formatting functions when setting up API definitions for all modules - Added new performance diagnostics when bPrintPerformanceInfo is enabled in BuildConfiguration.xml - We no longer check for "external" headers when scanning includes (this code didn't work at all) - Optimized CleanDirectorySeparators() utility function to avoid string copies Fixed UnrealBuildTool not saving DependencyCache under a platform-named folder [CL 2238266 by Mike Fricker in Main branch]
2014-07-31 09:34:11 -04:00
/** The last write time of the file. */
public DateTimeOffset _LastWriteTime;
public DateTimeOffset LastWriteTime
{
get
{
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
if (bIsRemoteFile)
{
LookupOutstandingFiles();
}
return _LastWriteTime;
}
set { _LastWriteTime = value; }
}
/** Whether the file exists. */
public bool _bExists = false;
public bool bExists
{
get
{
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
if (bIsRemoteFile)
{
LookupOutstandingFiles();
}
return _bExists;
}
set { _bExists = value; }
}
/** Size of the file if it exists, otherwise -1 */
public long _Length = -1;
public long Length
{
get
{
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
if (bIsRemoteFile)
{
LookupOutstandingFiles();
}
return _Length;
}
set { _Length = value; }
}
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
///
/// Statics
///
/** Used for performance debugging */
public static long TotalFileItemCount = 0;
public static long MissingFileItemCount = 0;
/** A case-insensitive dictionary that's used to map each unique file name to a single FileItem object. */
static Dictionary<string, FileItem> UniqueSourceFileMap = new Dictionary<string, FileItem>();
/** A list of remote file items that have been created but haven't needed the remote info yet, so we can gang up many into one request */
static List<FileItem> DelayedRemoteLookupFiles = new List<FileItem>();
/**
* Resolve any outstanding remote file info lookups
*/
private void LookupOutstandingFiles()
{
// for remote files, look up any outstanding files
if (bIsRemoteFile)
{
FileItem[] Files = null;
lock (DelayedRemoteLookupFiles)
{
if (DelayedRemoteLookupFiles.Count > 0)
{
// make an array so we can clear the original array, just in case BatchFileInfo does something that uses
// DelayedRemoteLookupFiles, so we don't deadlock
Files = DelayedRemoteLookupFiles.ToArray();
DelayedRemoteLookupFiles.Clear();
}
}
if (Files != null)
{
RPCUtilHelper.BatchFileInfo(Files);
}
}
}
/** @return The FileItem that represents the given file path. */
public static FileItem GetItemByPath(string FilePath)
{
var FullPath = Path.GetFullPath( FilePath );
return GetItemByFullPath( FullPath );
}
/** @return The FileItem that represents the given a full file path. */
public static FileItem GetItemByFullPath( string FullPath )
{
FileItem Result = null;
if( UniqueSourceFileMap.TryGetValue( FullPath.ToLowerInvariant(), out Result ) )
{
return Result;
}
else
{
return new FileItem( FullPath );
}
}
/** @return The remote FileItem that represents the given file path. */
public static FileItem GetRemoteItemByPath(string AbsoluteRemotePath, UnrealTargetPlatform Platform)
{
if (AbsoluteRemotePath.StartsWith("."))
{
throw new BuildException("GetRemoteItemByPath must be passed an absolute path, not a relative path '{0}'", AbsoluteRemotePath);
}
string InvariantPath = AbsoluteRemotePath.ToLowerInvariant();
FileItem Result = null;
if (UniqueSourceFileMap.TryGetValue(InvariantPath, out Result))
{
return Result;
}
else
{
return new FileItem(AbsoluteRemotePath, true, Platform);
}
}
/** If the given file path identifies a file that already exists, returns the FileItem that represents it. */
public static FileItem GetExistingItemByPath(string Path)
{
FileItem Result = GetItemByPath(Path);
if (Result.bExists)
{
return Result;
}
else
{
return null;
}
}
/// <summary>
/// Determines the appropriate encoding for a string: either ASCII or UTF-8.
/// </summary>
/// <param name="Str">The string to test.</param>
/// <returns>Either System.Text.Encoding.ASCII or System.Text.Encoding.UTF8, depending on whether or not the string contains non-ASCII characters.</returns>
private static Encoding GetEncodingForString(string Str)
{
// If the string length is equivalent to the encoded length, then no non-ASCII characters were present in the string.
return (Encoding.UTF8.GetByteCount(Str) == Str.Length) ? Encoding.ASCII : Encoding.UTF8;
}
/**
* Creates a text file with the given contents. If the contents of the text file aren't changed, it won't write the new contents to
* the file to avoid causing an action to be considered outdated.
*/
public static FileItem CreateIntermediateTextFile(string AbsolutePath, string Contents)
{
// Create the directory if it doesn't exist.
Directory.CreateDirectory(Path.GetDirectoryName(AbsolutePath));
// Only write the file if its contents have changed.
if (!File.Exists(AbsolutePath) || !String.Equals(Utils.ReadAllText(AbsolutePath), Contents, StringComparison.InvariantCultureIgnoreCase))
{
File.WriteAllText(AbsolutePath, Contents, GetEncodingForString(Contents));
}
return GetItemByPath(AbsolutePath);
}
/** Deletes the file. */
public void Delete()
{
Debug.Assert(_bExists);
Debug.Assert(!bIsRemoteFile);
int MaxRetryCount = 3;
int DeleteTryCount = 0;
bool bFileDeletedSuccessfully = false;
do
{
// If this isn't the first time through, sleep a little before trying again
if( DeleteTryCount > 0 )
{
Thread.Sleep( 1000 );
}
DeleteTryCount++;
try
{
// Delete the destination file if it exists
FileInfo DeletedFileInfo = new FileInfo( AbsolutePath );
if( DeletedFileInfo.Exists )
{
DeletedFileInfo.IsReadOnly = false;
DeletedFileInfo.Delete();
}
// Success!
bFileDeletedSuccessfully = true;
}
catch( Exception Ex )
{
Log.TraceInformation( "Failed to delete file '" + AbsolutePath + "'" );
Log.TraceInformation( " Exception: " + Ex.Message );
if( DeleteTryCount < MaxRetryCount )
{
Log.TraceInformation( "Attempting to retry..." );
}
else
{
Log.TraceInformation( "ERROR: Exhausted all retries!" );
}
}
}
while( !bFileDeletedSuccessfully && ( DeleteTryCount < MaxRetryCount ) );
}
/** Initialization constructor. */
protected FileItem (string FileAbsolutePath)
{
AbsolutePath = FileAbsolutePath;
ResetFileInfo();
++TotalFileItemCount;
if (!_bExists)
{
++MissingFileItemCount;
// Log.TraceInformation( "Missing: " + FileAbsolutePath );
}
UniqueSourceFileMap[ AbsolutePath.ToLowerInvariant() ] = this;
}
Experimental UnrealBuildTool makefile support UnrealBuildTool 'Makefiles' allow for very fast iterative builds. - New BuildConfiguration.xml setting added: "bUseExperimentalFastBuildIteration" (disabled by default) - 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 - New command-line parameters added: - "-Gather": Tells UBT to always perform the gather step (slower but will catch project structural changes) - "-NoGather": Disables the gather step, unless UBT detects that it must be done. This is the default when bUseExperimentalFastBuildIteration is enabled - "-GatherOnly": Runs the gather step and saves a UBTMakefile, but doesn't build anything - "-Assemble": Tells UBT to also assemble build products. This always defaults to enabled - "-NoAssemble": Tells UBT to skip the assemble step, whether we gathered build products or not - "-AssembleOnly": Tells UBT to only assemble build products and not to gather, unless UBT determines it must Other changes: - UBT now keeps track of which targets it was building in an intermediate file, to help it invalidate cached includes in subsequent runs when the targets are different - C++ includes are now stored in a class separate from the C++ compile enviroment (for easier serialization) - The method that UBT uses to find the CoreUObject module timestamp was rewritten - Various '@todo ubtmake' comments added to tag possible remaining Makefile tasks - The 'FileItem' class had some member variable comments and code cleaned up, while making it serializable - Cleaned up the comments and member variables in the "Action" class, while making it serializable - Some UBT classes are now "serializable". This is because we need to store the data in UBTMakefiles. - Removed support for Actions to tinker with Stdout and Stderror (was not used for anything) - Moved PrecompileHeaderEnvironment class to the UEBuildModule.cs source file - Plugin intermediate include directories are now selected on demand rather than cached early - Toolchain code for gathering prerequisite headers is now shared in a single function (AddPrerequisiteSourceFile) - Removed Action.StatusDetailedDescription, was not used for anything - Removed UEBuildConfiguration.bExcludePlugins, was not used for anything - Removed ECompilationResult.FailedDueToHeaderChange, was not used for anything [CL 2254472 by Mike Fricker in Main branch]
2014-08-13 08:17:43 -04:00
/** ISerializable: Constructor called when this object is deserialized */
protected FileItem( SerializationInfo SerializationInfo, StreamingContext StreamingContext )
{
ProducingAction = (Action)SerializationInfo.GetValue( "pa", typeof( Action ) );
AbsolutePath = SerializationInfo.GetString( "ap" );
bIsRemoteFile = SerializationInfo.GetBoolean( "rf" );
bNeedsHotReloadNumbersDLLCleanUp = SerializationInfo.GetBoolean( "hr" );
CachedCPPIncludeInfo = (CPPIncludeInfo)SerializationInfo.GetValue( "ci", typeof( CPPIncludeInfo ) );
// Go ahead and init normally now
{
ResetFileInfo();
++TotalFileItemCount;
if (!_bExists)
{
++MissingFileItemCount;
// Log.TraceInformation( "Missing: " + FileAbsolutePath );
}
if( bIsRemoteFile )
{
lock (DelayedRemoteLookupFiles)
{
DelayedRemoteLookupFiles.Add(this);
}
}
else
{
UniqueSourceFileMap[ AbsolutePath.ToLowerInvariant() ] = this;
}
}
}
/** ISerializable: Called when serialized to report additional properties that should be saved */
public void GetObjectData( SerializationInfo SerializationInfo, StreamingContext StreamingContext )
{
SerializationInfo.AddValue( "pa", ProducingAction );
SerializationInfo.AddValue( "ap", AbsolutePath );
SerializationInfo.AddValue( "rf", bIsRemoteFile );
SerializationInfo.AddValue( "hr", bNeedsHotReloadNumbersDLLCleanUp );
SerializationInfo.AddValue( "ci", CachedCPPIncludeInfo );
}
/// <summary>
/// (Re-)set file information for this FileItem
/// </summary>
public void ResetFileInfo()
{
if (Directory.Exists(AbsolutePath))
{
// path is actually a directory (such as a Mac app bundle)
_bExists = true;
LastWriteTime = Directory.GetLastWriteTimeUtc(AbsolutePath);
IsDirectory = true;
_Length = 0;
Info = null;
}
else
{
Info = new FileInfo(AbsolutePath);
_bExists = Info.Exists;
if (_bExists)
{
_LastWriteTime = Info.LastWriteTimeUtc;
_Length = Info.Length;
}
}
}
/// <summary>
/// Reset file information on all cached FileItems.
/// </summary>
public static void ResetInfos()
{
foreach (var Item in UniqueSourceFileMap)
{
Item.Value.ResetFileInfo();
}
}
/** Initialization constructor for optionally remote files. */
protected FileItem(string InAbsolutePath, bool InIsRemoteFile, UnrealTargetPlatform Platform)
{
bIsRemoteFile = InIsRemoteFile;
AbsolutePath = InAbsolutePath;
// @todo iosmerge: This doesn't handle remote directories (may be needed for compiling Mac from Windows)
if (bIsRemoteFile)
{
if (Platform == UnrealTargetPlatform.IOS || Platform == UnrealTargetPlatform.Mac)
{
lock (DelayedRemoteLookupFiles)
{
DelayedRemoteLookupFiles.Add(this);
}
}
else
{
throw new BuildException("Only IPhone and Mac support remote FileItems");
}
}
else
{
FileInfo Info = new FileInfo(AbsolutePath);
_bExists = Info.Exists;
if (_bExists)
{
_LastWriteTime = Info.LastWriteTimeUtc;
_Length = Info.Length;
}
++TotalFileItemCount;
if( !_bExists )
{
++MissingFileItemCount;
// Log.TraceInformation( "Missing: " + FileAbsolutePath );
}
}
// @todo iosmerge: This was in UE3, why commented out now?
//UniqueSourceFileMap[AbsolutePathUpperInvariant] = this;
}
public override string ToString()
{
return Path.GetFileName(AbsolutePath);
}
}
}