Files
UnrealEngineUWP/Engine/Source/Runtime/Projects/Public/ModuleDescriptor.h
Jaroslaw Palczynski 6c305898e0 UE-8578: Slate Widget fails to compile once added to a new project
Slate Widget was failing, because of missing Slate dependencies. Testing introduced a couple of problems which all was fixed by this CL:
1. I introduced AdditionalDependencies in .uproject file and change "Add Code To Project..." procedure to fill this array if needed. UBT reads this field and builds the project with required modules. Needed for Slate classes.
2. Changed UHT to #include missing headers in generated.h files if it was missing an include for it's super class. It was causing problems if we were trying to add a subclass of BrushShape -- BrushShape.h didn't have #include "Brush.h" and UBrushShape was inheriting from UBrush.
3. Above problems also occured for Slate classes, but not all of them was UCLASSes, so I had to fixed that manually.
4. "Add Code To Project..." functionality was not invalidating UBT makefiles, which lead to omitting new source files during hot-reloading (even thought it was reporting a success). This change also should improve a bit performance, cause right now there is no "gathering" step -- there is only invalidate step which is a lot quicker.
5. Fixed "Selected Class Source" link to source class in Slate Widget and Slate Widget Style class.

#codereview Robert.Manuszewski

[CL 2481488 by Jaroslaw Palczynski in Main branch]
2015-03-17 09:34:18 -04:00

141 lines
4.3 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Json.h"
enum class EModuleLoadResult;
/**
* Phase at which this module should be loaded during startup.
*/
namespace ELoadingPhase
{
enum Type
{
/** Loaded at the default loading point during startup (during engine init, after game modules are loaded.) */
Default,
/** Right after the default phase */
PostDefault,
/** Right before the default phase */
PreDefault,
/** Loaded before the engine is fully initialized, immediately after the config system has been initialized. Necessary only for very low-level hooks */
PostConfigInit,
/** Loaded before the engine is fully initialized for modules that need to hook into the loading screen before it triggers */
PreLoadingScreen,
/** After the engine has been initialized */
PostEngineInit,
// NOTE: If you add a new value, make sure to update the ToString() method below!
Max
};
/**
* Converts a string to a ELoadingPhase::Type value
*
* @param The string to convert to a value
* @return The corresponding value, or 'Max' if the string is not valid.
*/
PROJECTS_API ELoadingPhase::Type FromString( const TCHAR *Text );
/**
* Returns the name of a module load phase.
*
* @param The value to convert to a string
* @return The string representation of this enum value
*/
PROJECTS_API const TCHAR* ToString( const ELoadingPhase::Type Value );
};
/**
* Environment that can load a module.
*/
namespace EHostType
{
enum Type
{
Runtime,
RuntimeNoCommandlet,
Developer,
Editor,
EditorNoCommandlet,
Program, //!< Program-only plugin type
// NOTE: If you add a new value, make sure to update the ToString() method below!
Max
};
/**
* Converts a string to a EHostType::Type value
*
* @param The string to convert to a value
* @return The corresponding value, or 'Max' if the string is not valid.
*/
PROJECTS_API EHostType::Type FromString( const TCHAR *Text );
/**
* Converts an EHostType::Type value to a string literal
*
* @param The value to convert to a string
* @return The string representation of this enum value
*/
PROJECTS_API const TCHAR* ToString( const EHostType::Type Value );
};
/**
* Description of a loadable module.
*/
struct PROJECTS_API FModuleDescriptor
{
/** Name of this module */
FName Name;
/** Usage type of module */
EHostType::Type Type;
/** When should the module be loaded during the startup sequence? This is sort of an advanced setting. */
ELoadingPhase::Type LoadingPhase;
/** List of allowed platforms */
TArray<FString> WhitelistPlatforms;
/** List of disallowed platforms */
TArray<FString> BlacklistPlatforms;
/** List of additional dependencies for building this module. */
TArray<FString> AdditionalDependencies;
/** Normal constructor */
FModuleDescriptor(const FName InName = NAME_None, EHostType::Type InType = EHostType::Runtime, ELoadingPhase::Type InLoadingPhase = ELoadingPhase::Default);
/** Reads a descriptor from the given JSON object */
bool Read(const FJsonObject& Object, FText& OutFailReason);
/** Reads an array of modules from the given JSON object */
static bool ReadArray(const FJsonObject& Object, const TCHAR* Name, TArray<FModuleDescriptor>& OutModules, FText& OutFailReason);
/** Writes a descriptor to JSON */
void Write(TJsonWriter<>& Writer) const;
/** Writes an array of modules to JSON */
static void WriteArray(TJsonWriter<>& Writer, const TCHAR* Name, const TArray<FModuleDescriptor>& Modules);
/** Tests whether the module should be built for the current engine configuration */
bool IsCompiledInCurrentConfiguration() const;
/** Tests whether the module should be loaded for the current engine configuration */
bool IsLoadedInCurrentConfiguration() const;
/** Loads all the modules for a given loading phase. Returns a map of module names to load errors */
static void LoadModulesForPhase(ELoadingPhase::Type LoadingPhase, const TArray<FModuleDescriptor>& Modules, TMap<FName, EModuleLoadResult>& ModuleLoadErrors);
/** Checks that all modules are compatible with the current engine version. Returns false and appends a list of names to OutIncompatibleFiles if not. */
static bool CheckModuleCompatbility(const TArray<FModuleDescriptor>& Modules, bool bGameModules, TArray<FString>& OutIncompatibleFiles);
};