2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
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 "CoreMinimal.h"
|
|
|
|
|
#include "Modules/ModuleInterface.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
2014-10-13 16:53:31 -04:00
|
|
|
#include "ModuleDescriptor.h"
|
2015-02-16 04:29:11 -05:00
|
|
|
#include "AddToProjectConfig.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
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
|
|
|
struct FSlateBrush;
|
2014-08-18 06:48:04 -04:00
|
|
|
struct FTemplateCategory;
|
|
|
|
|
|
2014-10-13 11:47:21 -04:00
|
|
|
/** Context information used when validating that source code is being placed in the correct place for a given module */
|
|
|
|
|
struct FModuleContextInfo
|
|
|
|
|
{
|
|
|
|
|
/** Path to the Source folder of the module */
|
|
|
|
|
FString ModuleSourcePath;
|
|
|
|
|
|
|
|
|
|
/** Name of the module */
|
|
|
|
|
FString ModuleName;
|
|
|
|
|
|
|
|
|
|
/** Type of this module, eg, Runtime, Editor, etc */
|
2014-10-13 14:22:42 -04:00
|
|
|
enum EHostType::Type ModuleType;
|
2014-10-13 11:47:21 -04:00
|
|
|
};
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/**
|
2014-05-01 10:58:35 -04:00
|
|
|
* Game Project Generation module
|
2014-03-14 14:13:41 -04:00
|
|
|
*/
|
|
|
|
|
class FGameProjectGenerationModule : public IModuleInterface
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
2014-08-18 06:48:04 -04:00
|
|
|
typedef TMap<FName, TSharedPtr<FTemplateCategory>> FTemplateCategoryMap;
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called right after the plugin DLL has been loaded and the plugin object has been created
|
|
|
|
|
*/
|
|
|
|
|
virtual void StartupModule();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Called before the plugin is unloaded, right before the plugin object is destroyed.
|
|
|
|
|
*/
|
|
|
|
|
virtual void ShutdownModule();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Singleton-like access to this module's interface. This is just for convenience!
|
|
|
|
|
* Beware of calling this during the shutdown phase, though. Your module might have been unloaded already.
|
|
|
|
|
*
|
|
|
|
|
* @return Returns singleton instance, loading the module on demand if needed
|
|
|
|
|
*/
|
|
|
|
|
static inline FGameProjectGenerationModule& Get()
|
|
|
|
|
{
|
2015-01-16 15:39:47 -05:00
|
|
|
static const FName ModuleName = "GameProjectGeneration";
|
|
|
|
|
return FModuleManager::LoadModuleChecked< FGameProjectGenerationModule >( ModuleName );
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Creates the game project dialog */
|
|
|
|
|
virtual TSharedRef<class SWidget> CreateGameProjectDialog(bool bAllowProjectOpening, bool bAllowProjectCreate);
|
|
|
|
|
|
|
|
|
|
/** Creates a new class dialog for creating classes based on the passed-in class. */
|
2015-01-16 15:39:47 -05:00
|
|
|
virtual TSharedRef<class SWidget> CreateNewClassDialog(const UClass* InClass);
|
2015-02-16 04:29:11 -05:00
|
|
|
|
2015-01-16 15:39:47 -05:00
|
|
|
/**
|
|
|
|
|
* Opens a dialog to add code files to the current project.
|
|
|
|
|
*
|
2015-02-16 04:29:11 -05:00
|
|
|
* @param Config Dialog configuration options
|
2015-01-16 15:39:47 -05:00
|
|
|
*/
|
2015-02-16 04:29:11 -05:00
|
|
|
virtual void OpenAddCodeToProjectDialog(const FAddToProjectConfig& Config = FAddToProjectConfig());
|
2015-01-16 15:39:47 -05:00
|
|
|
|
|
|
|
|
/**
|
2015-02-16 04:29:11 -05:00
|
|
|
* Opens a dialog to add a new blueprint to the current project.
|
2015-01-16 15:39:47 -05:00
|
|
|
*
|
2015-02-16 04:29:11 -05:00
|
|
|
* @param Config Dialog configuration options
|
2015-01-16 15:39:47 -05:00
|
|
|
*/
|
2015-02-16 04:29:11 -05:00
|
|
|
virtual void OpenAddBlueprintToProjectDialog(const FAddToProjectConfig& Config);
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/** Delegate for when the AddCodeToProject dialog is opened */
|
|
|
|
|
DECLARE_EVENT(FGameProjectGenerationModule, FAddCodeToProjectDialogOpenedEvent);
|
|
|
|
|
FAddCodeToProjectDialogOpenedEvent& OnAddCodeToProjectDialogOpened() { return AddCodeToProjectDialogOpenedEvent; }
|
|
|
|
|
|
2014-06-27 15:23:15 -04:00
|
|
|
/** Tries to make the project file writable. Prompts to check out as necessary. */
|
2014-07-22 15:58:02 -04:00
|
|
|
virtual void TryMakeProjectFileWriteable(const FString& ProjectFile);
|
2014-06-27 15:23:15 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
/** Prompts the user to update his project file, if necessary. */
|
|
|
|
|
virtual void CheckForOutOfDateGameProjectFile();
|
|
|
|
|
|
|
|
|
|
/** Updates the currently loaded project. Returns true if the project was updated successfully or if no update was needed */
|
2014-07-22 15:58:02 -04:00
|
|
|
virtual bool UpdateGameProject(const FString& ProjectFile, const FString& EngineIdentifier, FText& OutFailReason);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** Updates the current code project */
|
2015-04-09 11:11:48 -04:00
|
|
|
virtual bool UpdateCodeProject(FText& OutFailReason, FText& OutFailLog);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** Gets the current projects source file count */
|
2014-10-13 11:47:21 -04:00
|
|
|
virtual bool ProjectHasCodeFiles();
|
|
|
|
|
|
|
|
|
|
/** Returns the path to the module's include header */
|
|
|
|
|
virtual FString DetermineModuleIncludePath(const FModuleContextInfo& ModuleInfo, const FString& FileRelativeTo);
|
|
|
|
|
|
2015-01-16 15:39:47 -05:00
|
|
|
/** Get the information about any modules referenced in the .uproject file of the currently loaded project */
|
2014-10-13 11:47:21 -04:00
|
|
|
virtual TArray<FModuleContextInfo> GetCurrentProjectModules();
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2015-01-16 15:39:47 -05:00
|
|
|
/** Returns true if the specified class is a valid base class for the given module */
|
|
|
|
|
virtual bool IsValidBaseClassForCreation(const UClass* InClass, const FModuleContextInfo& InModuleInfo);
|
|
|
|
|
|
|
|
|
|
/** Returns true if the specified class is a valid base class for any of the given modules */
|
|
|
|
|
virtual bool IsValidBaseClassForCreation(const UClass* InClass, const TArray<FModuleContextInfo>& InModuleInfoArray);
|
|
|
|
|
|
2014-08-22 11:35:01 -04:00
|
|
|
/** Gets file and size info about the source directory */
|
|
|
|
|
virtual void GetProjectSourceDirectoryInfo(int32& OutNumFiles, int64& OutDirectorySize);
|
|
|
|
|
|
2014-05-01 10:58:35 -04:00
|
|
|
/** Warn the user if the project filename is invalid in case they renamed it outside the editor */
|
|
|
|
|
virtual void CheckAndWarnProjectFilenameValid();
|
|
|
|
|
|
2014-10-13 11:47:21 -04:00
|
|
|
/** Generate basic project source code */
|
|
|
|
|
virtual bool GenerateBasicSourceCode(TArray<FString>& OutCreatedFiles, FText& OutFailReason);
|
|
|
|
|
|
2014-05-29 17:37:19 -04:00
|
|
|
/**
|
|
|
|
|
* Update the list of supported target platforms based upon the parameters provided
|
|
|
|
|
* This will take care of checking out and saving the updated .uproject file automatically
|
|
|
|
|
*
|
|
|
|
|
* @param InPlatformName Name of the platform to target (eg, WindowsNoEditor)
|
|
|
|
|
* @param bIsSupported true if the platform should be supported by this project, false if it should not
|
|
|
|
|
*/
|
|
|
|
|
virtual void UpdateSupportedTargetPlatforms(const FName& InPlatformName, const bool bIsSupported);
|
|
|
|
|
|
2014-06-05 12:13:44 -04:00
|
|
|
/** Clear the list of supported target platforms */
|
|
|
|
|
virtual void ClearSupportedTargetPlatforms();
|
|
|
|
|
|
2015-05-01 14:00:34 -04:00
|
|
|
/** Check to see if the project requires a code build */
|
|
|
|
|
virtual bool ProjectRequiresBuild(const FName InPlatformInfoName);
|
|
|
|
|
|
2014-08-18 06:48:04 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
/** (Un)register a new type of template category to be shown on the new project page */
|
2014-08-28 06:52:46 -04:00
|
|
|
virtual bool RegisterTemplateCategory(FName Type, FText Name, FText Description, const FSlateBrush* Icon, const FSlateBrush* Image);
|
2014-08-18 06:48:04 -04:00
|
|
|
virtual void UnRegisterTemplateCategory(FName Type);
|
|
|
|
|
|
|
|
|
|
// Non DLL-exposed access to template categories
|
|
|
|
|
TSharedPtr<const FTemplateCategory> GetCategory(FName Type) const { return TemplateCategories.FindRef(Type); }
|
|
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
private:
|
|
|
|
|
FAddCodeToProjectDialogOpenedEvent AddCodeToProjectDialogOpenedEvent;
|
|
|
|
|
|
2014-08-18 06:48:04 -04:00
|
|
|
/** Map of template categories from type to ptr */
|
|
|
|
|
FTemplateCategoryMap TemplateCategories;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|