Files
UnrealEngineUWP/Engine/Source/Runtime/Projects/Private/ProjectDescriptor.cpp
Josh Adams 1b3364e137 Copying //UE4/Dev-Platform to //UE4/Dev-Main (Source: //UE4/Dev-Platform @ 3173994)
#lockdown Nick.Penwarden

==========================
MAJOR FEATURES + CHANGES
==========================

Change 3118934 on 2016/09/08 by Jeff.Campeau

	Shader compression setting based on target platform instead of cooking host platform.

	#jira UE-35753

Change 3150366 on 2016/10/04 by Nick.Shin

	emscripten SDK 1.36.11

	windows and mac binaries will be checked in separately

	#jira UE-36562  -  //UE4/Main: Compile UE4Game HTML5 completed with errors: 2 errors

Change 3150367 on 2016/10/04 by Daniel.Lamb

	Removed caching of cooked platform data from postload.
	#test cook paragon

Change 3150368 on 2016/10/04 by Daniel.Lamb

	Added new setting to reserve the maximum amount of memory to leave free for the cooker..

Change 3151091 on 2016/10/04 by Nick.Shin

	upgrade emsdk toolchain to "tag-1.36.11"

	(along with updates to make scripts)

	#jira UEPLAT-890 - HTML5 Multithreading
	#jira UE-36562  -  //UE4/Main: Compile UE4Game HTML5 completed with errors: 2 errors

Change 3151205 on 2016/10/04 by Daniel.Lamb

	HasShaderJobs now includes the PendingFinalizedShadermaps in it's check
	#test cook paragon.

Change 3151501 on 2016/10/05 by Luke.Thatcher

	[PLATFORM] [PS4] [!] Fix memory usage in PS4 crash handler server.

	 - The ORTMAPI com object implements a Dispose method which we we're calling, so the object was leaked until it eventually gets GC'd.
	 - Whilst that object is alive, the orbis-debugserver-x64.exe process stays alive, using up to 2GB memory per instance.

	 - Also limited the server to processing a single crash dump at once, via a task queue.

Change 3151608 on 2016/10/05 by Nick.Shin

	fix CIS build warnings and errors

	this is for HTML5 platform

Change 3151851 on 2016/10/05 by Michael.Trepka

	Added DesktopRect and WorkArea to FMonitorInfo for desktop platforms and used that to fix an issue in SceneViewport where windowed fullscreen mode would be forced to primary monitor and incorrectly positioned on desktops where a taskbar/dock/etc. was on the left

	#jira FORT-30638

Change 3152085 on 2016/10/05 by Josh.Adams

	- Fixing some Wolf Launcher things (icon, string)

Change 3152451 on 2016/10/05 by Daniel.Lamb

	Enabled logging to help debug shader compiler issue.
	#test Cook Paragon.

Change 3152880 on 2016/10/05 by Dmitry.Rekman

	Linux: add support for new multiarch toolchain.

	- Redoing the change as submitted to Dev-Mobile.

Change 3152957 on 2016/10/05 by Dmitry.Rekman

	Linux: fix crosstoolchain for non-AutoSDKs case.

	- Redoing the fix for UE-36899 from Dev-Mobile.

Change 3153109 on 2016/10/06 by Keith.Judge

	Remove D3D11_RESOURCE_MISC_SHARED from XB1 D3D11.x RHI as it is invalid.

Change 3153176 on 2016/10/06 by Keith.Judge

	Xbox One - Disable engine analytics on XB1 shipping games, as per XRs. Verified http requests from devkit with Fiddler.

Change 3153213 on 2016/10/06 by Keith.Judge

	Xbox One - Plug small memory leak in the movie player.

Change 3153258 on 2016/10/06 by Josh.Adams

	- Moved Wolf OSS to proper location for Online plugins

Change 3153450 on 2016/10/06 by Josh.Adams

	wolf net driver class stub

Change 3153451 on 2016/10/06 by Josh.Adams

	- Fixed more Wolf OSS errors without special sdk

Change 3153471 on 2016/10/06 by Dmitry.Rekman

	Linux: fix always rebuilding FixDeps.

Change 3153472 on 2016/10/06 by Josh.Adams

	- Deleting some old test files

Change 3153535 on 2016/10/06 by Josh.Adams

	- And... fixed some build errors again with the special sdk

Change 3153819 on 2016/10/06 by Daniel.Lamb

	Remove some dead code in the cook on the fly server.
	#test Cook QAGame

Change 3154050 on 2016/10/06 by Dmitry.Rekman

	Linux: remove some of the clang 3.9.0 warnings.

	- Add missing destructors.
	- Deal with defined() being undefined in a #define.
	- Prevent casting nullptr to reference (or suppress that warning for third party code).
	- Case sensitivity fixes.
	- Make deoptimization work properly.

	- Code still crashes when compiling some of the editor targets.

Change 3154071 on 2016/10/06 by Josh.Adams

	- Fixed an issue with Wolf shader compiler optimizing out global array
	- Fixed Windows display internal thing

Change 3154567 on 2016/10/07 by Luke.Thatcher

	[PLATFORM] [PS4] [!] Hack fix for PS4 crash handler site leaking sony debug server processes.
	 - Find and kill the process after each task

Change 3154570 on 2016/10/07 by Keith.Judge

	Fix crash when run with -nolive. Unititialized member fix.

Change 3154572 on 2016/10/07 by Keith.Judge

	Xbox One - Small optimization I did a while ago for Paragon and forgot to submit. Removed the SRV dynamic/static distinction in the state cache and calling code, as it makes no difference since fast semantics.

Change 3154656 on 2016/10/07 by Dmitry.Rekman

	Linux: make Test configuration drop core by default.

Change 3154789 on 2016/10/07 by Dmitry.Rekman

	Linux: remove multiple instances of target platform device.

Change 3154957 on 2016/10/07 by Joe.Graf

	Changed additional plugin directories for project descriptors to be absolute in memory and path relative on disk

Change 3155298 on 2016/10/07 by Dmitry.Rekman

	Fix CIS (LinuxTargetDevice not linking).

Change 3155684 on 2016/10/07 by Josh.Adams

	- Added -PulseC option for Quickmatch

Change 3155691 on 2016/10/07 by Josh.Adams

	- New Wolf NetDriver for P2P sockets. Not working yet
	- OSS is _not_ currently usable, for reference

Change 3155750 on 2016/10/07 by Dmitry.Rekman

	Linux: fix UT server build (UE-37042).

Change 3156816 on 2016/10/10 by Josh.Adams

	- Fixed compile errors wihtout extra SDK bits

Change 3156872 on 2016/10/10 by Keith.Judge

	Xbox One - Fix corrupted screenshots. Needed a GPU/CPU sync point, which legacy D3D11.x used to do for us, but now we have to do manually.

	#jira UE-37038

Change 3156936 on 2016/10/10 by Josh.Adams

	- Backed out changes from files that got pulled into a changelist by mistake

Change 3157602 on 2016/10/10 by Josh.Adams

	- FIxed Wolf crash on level quit (at least in ShooterGame)

Change 3157676 on 2016/10/10 by Josh.Adams

	- Fixed Wolf audio playback in latest SDK

Change 3158544 on 2016/10/11 by Josh.Adams

	- Disabled one of the Wolf file mount points in Debug builds due to SDK bug

Change 3158603 on 2016/10/11 by Josh.Adams

	- FIxed type in non-Debug

Change 3159257 on 2016/10/11 by Dmitry.Rekman

	Linux: case-sensitive fixes.

Change 3159537 on 2016/10/12 by Luke.Thatcher

	[PLATFORM] [PS4] [!] Fix leaking orbis-dbgserver-x64 processes in PS4 crash handler.
	 - We needed to call Marshal.ReleaseComObject on the CoreFileAPI object to shut down the child processes.
	 - Disabled the kill process hack.

	[!] Also fixed "Unknown" usernames in PS4 crash dumps.
	 - Sony had changed the format of the PS4 settings file in system software 4.008.071.

	[!] Fixed exception getting modules from crash dump when symbols have not been loaded.
	 - Just skipping this step now, as it was only used for logging.

Change 3159581 on 2016/10/12 by Joe.Conley

	Wolf support for TPri_Lowest was missing, so I added that and the corresponding WolfThreadPriority_Lowest

Change 3159749 on 2016/10/12 by Luke.Thatcher

	[PLATFORM] [PS4] [~] Re-enable kill process hack in PS4 crash server. The ReleaseComObject fix hasn't solved the leaking processes on the server.

Change 3160336 on 2016/10/12 by Daniel.Lamb

	Fix for skip editor content flag being passed throught o UAT.
	#jira UE-37223

Change 3160341 on 2016/10/12 by Dmitry.Rekman

	Linux: fixes for Fortnite and Orion editors.

	- Also, again disable XGE because clang 3.9.0-based toolchain crashes when compiling those with XGE.

Change 3160473 on 2016/10/12 by Nick.Shin

	remove old emsdk

Change 3160528 on 2016/10/12 by Michael.Trepka

	Copy of CL 3160314 from //Fortnite/Main

	Fixed incorrect rect initialization in Mac GetDisplayMetrics

Change 3160591 on 2016/10/12 by Josh.Adams

	- Fixed wolf coimpiling without stats
	#jira UE-37230

Change 3160866 on 2016/10/12 by Dmitry.Rekman

	OpenGL: fix swapped arguments.

	- Cengiz noticed this while working on one of bugs.

Change 3160978 on 2016/10/12 by Josh.Adams

	- Fixed issue with running out of Wolf audio pools on large games

Change 3160979 on 2016/10/12 by Josh.Adams

	- Enabled Curl HTTP on Wolf, along with basic SSL (no local cert importing yet)

Change 3161025 on 2016/10/12 by Dmitry.Rekman

	Disable poison proxy.

	- Malloc::GetAllocationSize() may not account for alignment for mallocs like Binned and Binned2, resulting in a memory stomp.

Change 3161034 on 2016/10/12 by Josh.Adams

	-Wolf Http changes - load .pem files if they exist (although they aren't being staged automatically yet)
	- Added network pause to make sure its ready before we Http

Change 3161046 on 2016/10/12 by Dmitry.Rekman

	TestPAL: adding a test for Malloc::GetAllocationSize().

Change 3161212 on 2016/10/13 by Dan.Mahashin

	- Upgraded to new NXCP API. Confirmed to run ok with SunTemple on 0.11.2 SDK.

Change 3161624 on 2016/10/13 by Josh.Adams

	- Fixed MAX_PATH usage, should be PLATFORM_MAX_FILEPATH_LENGTH

Change 3161639 on 2016/10/13 by Josh.Adams

	- Added curl to main Wolf build since now it's used not just with OSS

Change 3161737 on 2016/10/13 by Josh.Adams

	- Added support for staging .pem files for SSL peer verification

Change 3161923 on 2016/10/13 by Dmitry.Rekman

	Linux: provide choice between RTLD_GLOBAL/LOCAL when opening DSOs (UE-36716).

	- By default, Unreal modules will be opened with RTLD_LOCAL (so the hot reload has a chance to work).
	- However, if "ue4_module_options" symbol is exported (a string with comma-separated options), and "linux_global_symbols" is present in that string, RTLD_LAZY will be used.
	- DSOs that don't have either ue4_module_options nor are recognized as UE4 modules will be loaded RTLD_GLOBAL.

	- PR #2823 by 20tab.

Change 3163532 on 2016/10/14 by Michael.Trepka

	Copy of CL 3162466

	By default, do not compile Mac OpenGL and Metal SM4 shaders while cooking

	#jira UE-37088

Change 3163550 on 2016/10/14 by Josh.Stoddard

	Fix key event processing during movies using FDefaultGameMoviePlayer
	#jira UE-37294

Change 3163687 on 2016/10/14 by Josh.Adams

	- Added a workaround for Wolf crashing inside vswprintf with %p

Change 3163693 on 2016/10/14 by Josh.Adams

	- Added a delegate for getting extra on-screen messages (like the Shaders to compile, etc).

Change 3163725 on 2016/10/14 by Josh.Adams

	- Added high level Wolf network transition functions for Wolf

Change 3163745 on 2016/10/14 by Josh.Adams

	- Wolf OSS changes for new high level networking logic, cleaned up includes, added on screen messages with status

Change 3164455 on 2016/10/17 by Josh.Adams

	- SOmehow a file wasn't checked out, but writable. Checking in now

Change 3164630 on 2016/10/17 by Michael.Trepka

	Copy of CL 3162062

	Replaced FWindowsCursor hack for warping the mouse cursor to the center of the viewport with a better fix for the original problem (users being able to resize the window while the cursor is hidden and the mouse controls the camera). This change removes round window corners in borderless window mode and disables window resizing when the cursor is hidden.

Change 3164975 on 2016/10/17 by Joe.Graf

	Changed the New Plugin Wizard to only show plugin types available for that project type (content only or code)

Change 3165213 on 2016/10/17 by Josh.Adams

	- Fixed some perf testing by disabling the startup benchmark for UT on non-desktop platforms

Change 3165576 on 2016/10/18 by Dan.Mahashin

	- Fix broken colors in QAGame UE-37197: depth write cannot work without depth test being enabled.

Change 3165809 on 2016/10/18 by Josh.Stoddard

	Enforce UMaterialExpressionActorPositionWS dependency on primitive uniform buffer #jira UE-37425 #rb chris.bunner

Change 3165948 on 2016/10/18 by Owen.Stupka

	Fix exception when creating an exception to say we don't have a 32-bit VC compiler installed.

Change 3166330 on 2016/10/18 by Dmitry.Rekman

	Linux: disable XGE on Windows (UE-37446).

	- XGE does not seem to handle new clang 3.9.0 toolchain well, with very reproducible crashes.

Change 3166456 on 2016/10/18 by Dmitry.Rekman

	Fix build breakage with clang 3.8.1.

	- always_inline was still applied to debug builds and as such was ignored.

Change 3166457 on 2016/10/18 by Chris.Babcock

	Add missing MultiviewOVR functions for Android deferred
	#jira UE-37401
	#ue4
	#android

Change 3166469 on 2016/10/18 by Dmitry.Rekman

	Linux: make target platform modules independent (UE-37370).

	- Module load order is different for target platform modules between UE4Editor and UE4Editor-Cmd, and dependent modules may end up being loaded first.

Change 3166755 on 2016/10/18 by Joe.Barnes

	[UE-35552] Enable PLATFORM_ENABLE_VECTORINTRINSICS_NEON on Wolf.

Change 3166757 on 2016/10/18 by Joe.Barnes

	[UE-35552] Optimized platform specific implementation of some common math functions.

Change 3166761 on 2016/10/18 by Joe.Barnes

	Use new 64 bit Power of 2 function.

Change 3167865 on 2016/10/19 by Josh.Adams

	- Wolf P2P/NAT stuff working!
	- Minor Wolf net mode fixes

Change 3167869 on 2016/10/19 by Josh.Adams

	- Moved  a blocking net call for Wolf Http into a thread

Change 3168100 on 2016/10/19 by Joe.Barnes

	#include <NVN/nvn_CppMethods.h>. Fixes a compiler problem with some inline functions not being available during compile phase.

Change 3168101 on 2016/10/19 by Joe.Barnes

	Exposed a function to create a platform based filename

Change 3168141 on 2016/10/19 by Dmitry.Rekman

	TestPAL: better test for allocation sizes.

Change 3168144 on 2016/10/19 by Dmitry.Rekman

	Fix for FMallocBinned::GetAllocationSize() for aligned allocations.

	Redoing SteveR's fix in 4.13/4.14.

	Copied from CL# 3165739.

	#jira UE-37249
	#jira UE-37243

Change 3168213 on 2016/10/19 by Josh.Adams

	- Wolf OSS function rename

Change 3168313 on 2016/10/19 by Josh.Adams

	Rename/move file(s)

Change 3168691 on 2016/10/20 by Dan.Mahashin

	- Fixed application teardown and memory leak:
	- NVNCommandContext was failing to free the last frame resources on shutdown (resources were thought to be in use because never actually processed by GPU)
	- NVNCommandContext was leaking a FSyncedFrameDestruction at each frame
	- NVNTempBlockManager was not freeing all of its temp blocks upon shutdown

Change 3168986 on 2016/10/20 by Josh.Adams

	- Removed some log spam

Change 3168990 on 2016/10/20 by Josh.Adams

	- Removed dead code

Change 3169091 on 2016/10/20 by Josh.Adams

	Moved UT's OnlineGameplayFramework plugin into NotForLicensees so licensees don't need Mcp

Change 3169262 on 2016/10/20 by Josh.Adams

	- Updated the OnScreenMessages to use a TMap of severity to message, so we can have multiple colors, etc
	- Also has some fixes needed from a merge down (oops)

Change 3169363 on 2016/10/20 by Dmitry.Rekman

	TestPAL: final synth test for stomp.

Change 3169436 on 2016/10/20 by Michael.Trepka

	Change the minimum supported macOS version setting in Info.plists to 10.11.6

Change 3169510 on 2016/10/20 by Dmitry.Rekman

	TestPAL: added stomp test with poison proxy.

Change 3169972 on 2016/10/20 by Dmitry.Rekman

	Re-enable PoisonProxy.

Change 3170000 on 2016/10/20 by Dmitry.Rekman

	Linux: minor code cleanup.

Change 3170400 on 2016/10/21 by Josh.Adams

	- Added a comment with current supported SDK in UEBuildWolf.cs

Change 3170929 on 2016/10/21 by Josh.Adams

	- Added generic Elf symbol parser to MemoryProfiler2 app. It uses nm.exe, and any platform that uses it would need to subclass it (which Wolf now does)

Change 3171266 on 2016/10/21 by Dmitry.Rekman

	Linux: fix Setup.sh on Ubuntu 16.10 (UE-37621)

Change 3172847 on 2016/10/24 by Josh.Adams

	- Added a null Material check to the recent change to UMaterialExpressionActorPositionWS
	#jira UE-37730

Change 3173535 on 2016/10/25 by Josh.Adams

	- Helping clean up some misplaced files, since obliterate caused problems with BulletProofSync

[CL 3174242 by Josh Adams in Main branch]
2016-10-25 18:15:13 -04:00

274 lines
8.5 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "ProjectsPrivatePCH.h"
#include "ProjectDescriptor.h"
#define LOCTEXT_NAMESPACE "ProjectDescriptor"
FProjectDescriptor::FProjectDescriptor()
{
FileVersion = EProjectDescriptorVersion::Latest;
EpicSampleNameHash = 0;
}
void FProjectDescriptor::Sign(const FString& FilePath)
{
EpicSampleNameHash = GetTypeHash(FPaths::GetCleanFilename(FilePath));
}
bool FProjectDescriptor::IsSigned(const FString& FilePath) const
{
return EpicSampleNameHash == GetTypeHash(FPaths::GetCleanFilename(FilePath));
}
int32 FProjectDescriptor::FindPluginReferenceIndex(const FString& PluginName) const
{
for(int32 Idx = 0; Idx < Plugins.Num(); Idx++)
{
if(Plugins[Idx].Name == PluginName)
{
return Idx;
}
}
return INDEX_NONE;
}
void FProjectDescriptor::UpdateSupportedTargetPlatforms(const FName& InPlatformName, bool bIsSupported)
{
if ( bIsSupported )
{
TargetPlatforms.AddUnique(InPlatformName);
}
else
{
TargetPlatforms.Remove(InPlatformName);
}
}
static bool IsRootedPath(const FString& Path)
{
return Path[0] == TEXT('\\') || Path[0] == TEXT('/') || Path[1] == TEXT(':');
}
bool FProjectDescriptor::Load(const FString& FileName, FText& OutFailReason)
{
// Read the file to a string
FString FileContents;
if (!FFileHelper::LoadFileToString(FileContents, *FileName))
{
OutFailReason = FText::Format(LOCTEXT("FailedToLoadDescriptorFile", "Failed to open descriptor file '{0}'"), FText::FromString(FileName));
return false;
}
// Deserialize a JSON object from the string
TSharedPtr< FJsonObject > Object;
TSharedRef< TJsonReader<> > Reader = TJsonReaderFactory<>::Create(FileContents);
if ( !FJsonSerializer::Deserialize(Reader, Object) || !Object.IsValid() )
{
OutFailReason = FText::Format(LOCTEXT("FailedToReadDescriptorFile", "Failed to read file. {0}"), FText::FromString(Reader->GetErrorMessage()));
return false;
}
// Parse it as a project descriptor
return Read(*Object.Get(), FPaths::GetPath(FileName), OutFailReason);
}
bool FProjectDescriptor::Read(const FJsonObject& Object, const FString& PathToProject, FText& OutFailReason)
{
// Read the file version
int32 FileVersionInt32;
if(!Object.TryGetNumberField(TEXT("FileVersion"), FileVersionInt32))
{
if(!Object.TryGetNumberField(TEXT("ProjectFileVersion"), FileVersionInt32))
{
OutFailReason = LOCTEXT("InvalidProjectFileVersion", "File does not have a valid 'FileVersion' number.");
return false;
}
}
// Check that it's within range
FileVersion = (EProjectDescriptorVersion::Type)FileVersionInt32;
if ( FileVersion <= EProjectDescriptorVersion::Invalid || FileVersion > EProjectDescriptorVersion::Latest )
{
FText ReadVersionText = FText::FromString( FString::Printf( TEXT( "%d" ), (int32)FileVersion ) );
FText LatestVersionText = FText::FromString( FString::Printf( TEXT( "%d" ), (int32)EProjectDescriptorVersion::Latest ) );
OutFailReason = FText::Format( LOCTEXT("ProjectFileVersionTooLarge", "File appears to be in a newer version ({0}) of the file format that we can load (max version: {1})."), ReadVersionText, LatestVersionText);
return false;
}
// Read simple fields
Object.TryGetStringField(TEXT("EngineAssociation"), EngineAssociation);
Object.TryGetStringField(TEXT("Category"), Category);
Object.TryGetStringField(TEXT("Description"), Description);
// Read the modules
if(!FModuleDescriptor::ReadArray(Object, TEXT("Modules"), Modules, OutFailReason))
{
return false;
}
// Read the plugins
if(!FPluginReferenceDescriptor::ReadArray(Object, TEXT("Plugins"), Plugins, OutFailReason))
{
return false;
}
// Read the list of additional plugin directories to scan
const TArray< TSharedPtr<FJsonValue> >* AdditionalPluginDirectoriesValue;
if (Object.TryGetArrayField(TEXT("AdditionalPluginDirectories"), AdditionalPluginDirectoriesValue))
{
for (int32 Idx = 0; Idx < AdditionalPluginDirectoriesValue->Num(); Idx++)
{
FString AdditionalDir;
if ((*AdditionalPluginDirectoriesValue)[Idx]->TryGetString(AdditionalDir))
{
if (IsRootedPath(AdditionalDir))
{
AddPluginDirectory(AdditionalDir);
}
else
{
// This is path relative to the project, so convert to absolute
AddPluginDirectory(IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*(PathToProject / AdditionalDir)));
}
}
}
}
// Read the target platforms
const TArray< TSharedPtr<FJsonValue> > *TargetPlatformsValue;
if(Object.TryGetArrayField(TEXT("TargetPlatforms"), TargetPlatformsValue))
{
for(int32 Idx = 0; Idx < TargetPlatformsValue->Num(); Idx++)
{
FString TargetPlatform;
if((*TargetPlatformsValue)[Idx]->TryGetString(TargetPlatform))
{
TargetPlatforms.Add(*TargetPlatform);
}
}
}
// Get the sample name hash
Object.TryGetNumberField(TEXT("EpicSampleNameHash"), EpicSampleNameHash);
// Read the custom build steps
PreBuildSteps.Read(Object, TEXT("PreBuildSteps"));
PostBuildSteps.Read(Object, TEXT("PostBuildSteps"));
return true;
}
bool FProjectDescriptor::Save(const FString& FileName, FText& OutFailReason)
{
// Write the contents of the descriptor to a string. Make sure the writer is destroyed so that the contents are flushed to the string.
FString Text;
TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create(&Text);
Write(Writer.Get(), FPaths::GetPath(FileName));
Writer->Close();
// Save it to a file
if ( FFileHelper::SaveStringToFile(Text, *FileName) )
{
return true;
}
else
{
OutFailReason = FText::Format( LOCTEXT("FailedToWriteOutputFile", "Failed to write output file '{0}'. Perhaps the file is Read-Only?"), FText::FromString(FileName) );
return false;
}
}
void FProjectDescriptor::Write(TJsonWriter<>& Writer, const FString& PathToProject) const
{
Writer.WriteObjectStart();
// Write all the simple fields
Writer.WriteValue(TEXT("FileVersion"), EProjectDescriptorVersion::Latest);
Writer.WriteValue(TEXT("EngineAssociation"), EngineAssociation);
Writer.WriteValue(TEXT("Category"), Category);
Writer.WriteValue(TEXT("Description"), Description);
// Write the module list
FModuleDescriptor::WriteArray(Writer, TEXT("Modules"), Modules);
// Write the plugin list
FPluginReferenceDescriptor::WriteArray(Writer, TEXT("Plugins"), Plugins);
// Write out the additional plugin directories to scan
if (AdditionalPluginDirectories.Num() > 0)
{
Writer.WriteArrayStart(TEXT("AdditionalPluginDirectories"));
for (const FString& Dir : AdditionalPluginDirectories)
{
// Convert to relative path if possible before writing it out
Writer.WriteValue(MakePathRelativeToProject(Dir, PathToProject));
}
Writer.WriteArrayEnd();
}
// Write the target platforms
if(TargetPlatforms.Num() > 0)
{
Writer.WriteArrayStart(TEXT("TargetPlatforms"));
for(int Idx = 0; Idx < TargetPlatforms.Num(); Idx++)
{
Writer.WriteValue(TargetPlatforms[Idx].ToString());
}
Writer.WriteArrayEnd();
}
// If it's a signed sample, write the name hash
if(EpicSampleNameHash != 0)
{
Writer.WriteValue(TEXT("EpicSampleNameHash"), FString::Printf(TEXT("%u"), EpicSampleNameHash));
}
// Write the custom build steps
if(!PreBuildSteps.IsEmpty())
{
PreBuildSteps.Write(Writer, TEXT("PreBuildSteps"));
}
if(!PostBuildSteps.IsEmpty())
{
PostBuildSteps.Write(Writer, TEXT("PostBuildSteps"));
}
Writer.WriteObjectEnd();
}
FString FProjectDescriptor::GetExtension()
{
static const FString ProjectExtension(TEXT("uproject"));
return ProjectExtension;
}
/** @return the path relative to this project if possible */
const FString FProjectDescriptor::MakePathRelativeToProject(const FString& Dir, const FString& PathToProject) const
{
FString ProjectDir = IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*(PathToProject / TEXT("")));
FPaths::MakePlatformFilename(ProjectDir);
FString ModifiedDir(Dir);
FPaths::MakePathRelativeTo(ModifiedDir, *ProjectDir);
return ModifiedDir;
}
void FProjectDescriptor::AddPluginDirectory(const FString& AdditionalDir)
{
check(!AdditionalDir.StartsWith(IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*FPaths::GamePluginsDir())));
check(!AdditionalDir.StartsWith(IFileManager::Get().ConvertToAbsolutePathForExternalAppForWrite(*FPaths::EnginePluginsDir())));
// Detect calls where the path is not absolute
check(IsRootedPath(AdditionalDir));
AdditionalPluginDirectories.AddUnique(AdditionalDir);
}
void FProjectDescriptor::RemovePluginDirectory(const FString& Dir)
{
// Detect calls where the path is not absolute
check(IsRootedPath(Dir));
AdditionalPluginDirectories.RemoveSingle(Dir);
}
#undef LOCTEXT_NAMESPACE