2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2015-08-03 09:03:34 -04:00
|
|
|
|
|
|
|
|
#include "VersionManifest.h"
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "Misc/FileHelper.h"
|
|
|
|
|
#include "Misc/App.h"
|
|
|
|
|
#include "Serialization/JsonTypes.h"
|
|
|
|
|
#include "Serialization/JsonReader.h"
|
|
|
|
|
#include "Serialization/JsonSerializer.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
2015-08-03 09:03:34 -04:00
|
|
|
|
|
|
|
|
FVersionManifest::FVersionManifest()
|
|
|
|
|
{
|
|
|
|
|
Changelist = 0;
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3145834)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3129636 on 2016/09/17 by Ben.Marsh
UBT: Add a "-nolink" option which allows compiling object files without linking them into an executable. Useful for non-unity builds, which take a very long time to link or fail on some platforms due to command lines being too long, PDB file having too many records, etc...
Change 3129825 on 2016/09/18 by Ben.Marsh
UBT: Don't force Linux to build in unity; it seems to build fine without.
Change 3129965 on 2016/09/19 by Matthew.Griffin
Duplicating CL#3129960 from Release-4.13
Exclude NetworkProfiler when building CS tools for Linux
Change 3130653 on 2016/09/19 by Ben.Marsh
UHT: Fix missing "Error:" prefix in output log, causing messages to be ignored for failure emails.
Change 3130662 on 2016/09/19 by Ben.Marsh
EC: Prevent UHT failures from being reported twice, and remove the need for special case to show UHT summary output.
Change 3131956 on 2016/09/20 by Matthew.Griffin
Addtional fixes for compiling Editor as a monolithic executable
Change so monolithic editor is output to Project Binaries directory
Removed duplicated ReturnContainerIndexFromChannelName function
Only check for out of date modules for non monolithic editor
Don't define GIsGameAgnosticExe or PER_MODULE_BOILERPLATE for monolithic editor, done elsewhere
Correct IMPLEMENT_MODULE for QuadricMeshReduction and AudioCapture modules
Change 3132112 on 2016/09/20 by Ben.Marsh
Docs: Remove reference to UBT environment variables from configuration docs.
Change 3132815 on 2016/09/20 by Ben.Marsh
AutomationTool: Delete GUBP. Everything now uses BuildGraph!
Change 3132871 on 2016/09/20 by Ben.Marsh
UBT: Remove GUBP callbacks from TargetRules instances.
Change 3132987 on 2016/09/20 by Ben.Marsh
Allow public distribution of the compiled SimplygonMeshUtilities binaries.
Change 3133974 on 2016/09/21 by Ben.Marsh
Allow public distribution of the SimplygonSwarm module. Requires a separate Simplygon DLL (still in a NotForLicensees folder) to function correctly.
Change 3137228 on 2016/09/22 by Ben.Marsh
UAT: Merging fix to parallel executor on Linux from 4.13 branch.
Change 3139783 on 2016/09/26 by Matthew.Griffin
Fixed Xbox support for Installed Builds
Corrected typo in Xbox+PS4 filter creation and added XboxOnePackageNameUtil.exe
Added Xbox versions of ThirdParty libs that hadn't been specified until now
Change 3141721 on 2016/09/27 by Ben.Marsh
Remove declaration of circular references between FbxAutomationTestBuilder and LevelEditor; causes LevelEditor to be built differently if plugin is enabled, which results in shared build products being invalidated by switching between games.
Change 3141789 on 2016/09/27 by Ben.Marsh
UBT: Retain the ".suppressed" part of output file names when building import libraries for circularly referenced modules.
Change 3141805 on 2016/09/27 by Ben.Marsh
UBT: Allow reusing build ids in version manifests as long as we aren't modifying any engine binaries (building more or fewer is permitted), and merge manifests together if possible. Allows building the entire solution through Visual Studio, when some projects may build more modules than another.
Change 3141980 on 2016/09/27 by Ben.Marsh
EC: Include a "Steps to Reproduce" section in failure emails, which gives the command line to run to execute the step.
Change 3143996 on 2016/09/28 by Ben.Marsh
BuildGraph: Fix exported job steps having dependencies on nodes behind triggers, causing jobs to never terminate.
Change 3144696 on 2016/09/29 by Matthew.Griffin
Adding -NoSharedPCH to NonUnity build steps and split them into separate nodes for UE4Editor and UE4Game
Fixed redefinition of __WINDOWS_DS__
Change 3144931 on 2016/09/29 by Ben.Marsh
Core: Changes to search paths for DLL loading.
* The default binaries directory is now added to the list of search paths. Normally LoadLibrary finds these without needing to preload them, but plugins can change the global search paths by calling SetDefaultDllDirectories().
* Only the top entry of the DLL directory stack is searched. There is typically only one directory here anyway, but the intent is more consistent with the operation of SetDllDirectory().
* Resolved import paths are converted to absolute, so the resulting calls to LoadLibrary will not be influenced by calls to SetDefaultDllDirectories() changing the base directory.
* Search paths aren't de-duplicated any more. They don't overlap in practice, and it's not expensive even if they do.
Change 3144932 on 2016/09/29 by Ben.Marsh
Vulkan: Only add vulkan-1.dll as a delay load dependency from the VulkanRHI module, otherwise it can be added to the linker command-line 20 or more times.
Change 3145011 on 2016/09/29 by Ben.Marsh
Core: Include the compatible changelist in version manifests, so local builds after syncing with UGS will have the correct compatible changelist numbers post-hotfix.
[CL 3146509 by Ben Marsh in Main branch]
2016-09-30 08:50:19 -04:00
|
|
|
CompatibleChangelist = 0;
|
2015-08-03 09:03:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FString FVersionManifest::GetFileName(const FString& DirectoryName, bool bIsGameFolder)
|
|
|
|
|
{
|
|
|
|
|
FString FileName = DirectoryName / FPlatformProcess::ExecutableName();
|
|
|
|
|
if(FApp::GetBuildConfiguration() == EBuildConfigurations::DebugGame && bIsGameFolder)
|
|
|
|
|
{
|
|
|
|
|
FileName += FString::Printf(TEXT("-%s-DebugGame"), FPlatformProcess::GetBinariesSubdirectory());
|
|
|
|
|
}
|
|
|
|
|
return FileName + TEXT(".modules");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FVersionManifest::TryRead(const FString& FileName, FVersionManifest& Manifest)
|
|
|
|
|
{
|
|
|
|
|
// Read the file to a string
|
|
|
|
|
FString Text;
|
|
|
|
|
if (!FFileHelper::LoadFileToString(Text, *FileName))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deserialize a JSON object from the string
|
|
|
|
|
TSharedPtr< FJsonObject > ObjectPtr;
|
|
|
|
|
TSharedRef< TJsonReader<> > Reader = TJsonReaderFactory<>::Create(Text);
|
|
|
|
|
if (!FJsonSerializer::Deserialize(Reader, ObjectPtr) || !ObjectPtr.IsValid() )
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
FJsonObject& Object = *ObjectPtr.Get();
|
|
|
|
|
|
|
|
|
|
// Read the changelist and build id
|
|
|
|
|
if(!Object.TryGetNumberField(TEXT("Changelist"), Manifest.Changelist) || !Object.TryGetStringField(TEXT("BuildId"), Manifest.BuildId))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3145834)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3129636 on 2016/09/17 by Ben.Marsh
UBT: Add a "-nolink" option which allows compiling object files without linking them into an executable. Useful for non-unity builds, which take a very long time to link or fail on some platforms due to command lines being too long, PDB file having too many records, etc...
Change 3129825 on 2016/09/18 by Ben.Marsh
UBT: Don't force Linux to build in unity; it seems to build fine without.
Change 3129965 on 2016/09/19 by Matthew.Griffin
Duplicating CL#3129960 from Release-4.13
Exclude NetworkProfiler when building CS tools for Linux
Change 3130653 on 2016/09/19 by Ben.Marsh
UHT: Fix missing "Error:" prefix in output log, causing messages to be ignored for failure emails.
Change 3130662 on 2016/09/19 by Ben.Marsh
EC: Prevent UHT failures from being reported twice, and remove the need for special case to show UHT summary output.
Change 3131956 on 2016/09/20 by Matthew.Griffin
Addtional fixes for compiling Editor as a monolithic executable
Change so monolithic editor is output to Project Binaries directory
Removed duplicated ReturnContainerIndexFromChannelName function
Only check for out of date modules for non monolithic editor
Don't define GIsGameAgnosticExe or PER_MODULE_BOILERPLATE for monolithic editor, done elsewhere
Correct IMPLEMENT_MODULE for QuadricMeshReduction and AudioCapture modules
Change 3132112 on 2016/09/20 by Ben.Marsh
Docs: Remove reference to UBT environment variables from configuration docs.
Change 3132815 on 2016/09/20 by Ben.Marsh
AutomationTool: Delete GUBP. Everything now uses BuildGraph!
Change 3132871 on 2016/09/20 by Ben.Marsh
UBT: Remove GUBP callbacks from TargetRules instances.
Change 3132987 on 2016/09/20 by Ben.Marsh
Allow public distribution of the compiled SimplygonMeshUtilities binaries.
Change 3133974 on 2016/09/21 by Ben.Marsh
Allow public distribution of the SimplygonSwarm module. Requires a separate Simplygon DLL (still in a NotForLicensees folder) to function correctly.
Change 3137228 on 2016/09/22 by Ben.Marsh
UAT: Merging fix to parallel executor on Linux from 4.13 branch.
Change 3139783 on 2016/09/26 by Matthew.Griffin
Fixed Xbox support for Installed Builds
Corrected typo in Xbox+PS4 filter creation and added XboxOnePackageNameUtil.exe
Added Xbox versions of ThirdParty libs that hadn't been specified until now
Change 3141721 on 2016/09/27 by Ben.Marsh
Remove declaration of circular references between FbxAutomationTestBuilder and LevelEditor; causes LevelEditor to be built differently if plugin is enabled, which results in shared build products being invalidated by switching between games.
Change 3141789 on 2016/09/27 by Ben.Marsh
UBT: Retain the ".suppressed" part of output file names when building import libraries for circularly referenced modules.
Change 3141805 on 2016/09/27 by Ben.Marsh
UBT: Allow reusing build ids in version manifests as long as we aren't modifying any engine binaries (building more or fewer is permitted), and merge manifests together if possible. Allows building the entire solution through Visual Studio, when some projects may build more modules than another.
Change 3141980 on 2016/09/27 by Ben.Marsh
EC: Include a "Steps to Reproduce" section in failure emails, which gives the command line to run to execute the step.
Change 3143996 on 2016/09/28 by Ben.Marsh
BuildGraph: Fix exported job steps having dependencies on nodes behind triggers, causing jobs to never terminate.
Change 3144696 on 2016/09/29 by Matthew.Griffin
Adding -NoSharedPCH to NonUnity build steps and split them into separate nodes for UE4Editor and UE4Game
Fixed redefinition of __WINDOWS_DS__
Change 3144931 on 2016/09/29 by Ben.Marsh
Core: Changes to search paths for DLL loading.
* The default binaries directory is now added to the list of search paths. Normally LoadLibrary finds these without needing to preload them, but plugins can change the global search paths by calling SetDefaultDllDirectories().
* Only the top entry of the DLL directory stack is searched. There is typically only one directory here anyway, but the intent is more consistent with the operation of SetDllDirectory().
* Resolved import paths are converted to absolute, so the resulting calls to LoadLibrary will not be influenced by calls to SetDefaultDllDirectories() changing the base directory.
* Search paths aren't de-duplicated any more. They don't overlap in practice, and it's not expensive even if they do.
Change 3144932 on 2016/09/29 by Ben.Marsh
Vulkan: Only add vulkan-1.dll as a delay load dependency from the VulkanRHI module, otherwise it can be added to the linker command-line 20 or more times.
Change 3145011 on 2016/09/29 by Ben.Marsh
Core: Include the compatible changelist in version manifests, so local builds after syncing with UGS will have the correct compatible changelist numbers post-hotfix.
[CL 3146509 by Ben Marsh in Main branch]
2016-09-30 08:50:19 -04:00
|
|
|
// Read the compatible changelist, or default to the current changelist if it's not set
|
|
|
|
|
if(Manifest.Changelist == 0 || !Object.TryGetNumberField(TEXT("CompatibleChangelist"), Manifest.CompatibleChangelist))
|
|
|
|
|
{
|
|
|
|
|
Manifest.CompatibleChangelist = Manifest.Changelist;
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-03 09:03:34 -04:00
|
|
|
// Read the module mappings
|
|
|
|
|
TSharedPtr<FJsonObject> ModulesObject = Object.GetObjectField(TEXT("Modules"));
|
|
|
|
|
if(ModulesObject.IsValid())
|
|
|
|
|
{
|
|
|
|
|
for(TPair<FString, TSharedPtr<FJsonValue>>& Pair: ModulesObject->Values)
|
|
|
|
|
{
|
|
|
|
|
if(Pair.Value->Type == EJson::String)
|
|
|
|
|
{
|
|
|
|
|
Manifest.ModuleNameToFileName.FindOrAdd(Pair.Key) = Pair.Value->AsString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FVersionedModuleEnumerator::FVersionedModuleEnumerator()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FVersionedModuleEnumerator::RegisterWithModuleManager()
|
|
|
|
|
{
|
|
|
|
|
FString VersionManifestFileName = FVersionManifest::GetFileName(FPlatformProcess::BaseDir(), false);
|
|
|
|
|
if(!FVersionManifest::TryRead(VersionManifestFileName, InitialManifest))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FModuleManager::Get().QueryModulesDelegate.BindRaw(this, &FVersionedModuleEnumerator::QueryModules);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const FVersionManifest& FVersionedModuleEnumerator::GetInitialManifest() const
|
|
|
|
|
{
|
|
|
|
|
return InitialManifest;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void FVersionedModuleEnumerator::QueryModules(const FString& InDirectoryName, bool bIsGameDirectory, TMap<FString, FString>& OutModules) const
|
|
|
|
|
{
|
|
|
|
|
FVersionManifest Manifest;
|
|
|
|
|
if(FVersionManifest::TryRead(FVersionManifest::GetFileName(InDirectoryName, bIsGameDirectory), Manifest) && IsMatchingVersion(Manifest))
|
|
|
|
|
{
|
|
|
|
|
OutModules = Manifest.ModuleNameToFileName;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool FVersionedModuleEnumerator::IsMatchingVersion(const FVersionManifest& Manifest) const
|
|
|
|
|
{
|
|
|
|
|
if(InitialManifest.Changelist == 0)
|
|
|
|
|
{
|
|
|
|
|
return Manifest.Changelist == 0 && (InitialManifest.BuildId == Manifest.BuildId || Manifest.BuildId.Len() == 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return InitialManifest.Changelist == Manifest.Changelist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|