You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb trivial #rnx #preflight 626a5913631e64c0b9f23de3 - Some of our local structures, like FPLugin can get confused by the debugger with the version in the engine. Wrapping the tools code in the virtualization namespace helps keep the separation clear and stops the debugger from getting confused. - Plus even though this is an UE program, I probably should've stuck to the new namespace rules anyway. #ushell-cherrypick of 19955706 by paul.chipchase [CL 19956237 by paul chipchase in ue5-main branch]
141 lines
3.7 KiB
C++
141 lines
3.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "Containers/Array.h"
|
|
#include "Containers/UnrealString.h"
|
|
#include "ISourceControlChangelist.h" // TODO
|
|
#include "Templates/UniquePtr.h"
|
|
|
|
class ISourceControlProvider;
|
|
|
|
namespace UE::Virtualization
|
|
{
|
|
|
|
struct FPlugin
|
|
{
|
|
FString PluginFilePath;
|
|
|
|
TArray<FString> PackagePaths;
|
|
};
|
|
|
|
struct FProject
|
|
{
|
|
FString ProjectFilePath;
|
|
|
|
TArray<FPlugin> Plugins;
|
|
TArray<FString> PackagePaths;
|
|
|
|
void AddFile(const FString& FilePath);
|
|
void AddPluginFile(const FString& FilePath, const FString& PluginFilePath);
|
|
|
|
FStringView GetProjectName() const;
|
|
TArray<FString> GetAllPackages() const;
|
|
|
|
void RegisterMountPoints() const;
|
|
void UnRegisterMountPoints() const;
|
|
|
|
bool TryLoadConfig(FConfigFile& OutConfig) const;
|
|
};
|
|
|
|
/** The mode of the application to run */
|
|
enum class EMode :uint32
|
|
{
|
|
/** Error condition */
|
|
Unknown = 0,
|
|
/** Virtualize and submit a given changelist */
|
|
Changelist,
|
|
/** Virtualize a list of packages provided by text file */
|
|
PackageList
|
|
};
|
|
|
|
// Note that the enum doesn't give us huge value right now, it has been provided
|
|
// in case that we expand with additional functionality in the future.
|
|
|
|
/** A bitfield of the various operations that the virtualization process supports */
|
|
enum class EProcessOptions : uint32
|
|
{
|
|
/** No options */
|
|
None = 0,
|
|
/** Virtualize the packages in the provided changelist */
|
|
Virtualize = 1 << 0,
|
|
/** Submit the changelist */
|
|
Submit = 1 << 1
|
|
};
|
|
ENUM_CLASS_FLAGS(EProcessOptions);
|
|
|
|
/** The result of FUnrealVirtualizationToolApp initialization */
|
|
enum class EInitResult
|
|
{
|
|
/** Initialization succeeded and the application should run. */
|
|
Success = 0,
|
|
/** No error was encountered but the application should early out and not run. */
|
|
EarlyOut,
|
|
/** Initialization failed with an error, we should not run and should display an error to the user */
|
|
Error
|
|
};
|
|
|
|
class FUnrealVirtualizationToolApp
|
|
{
|
|
public:
|
|
FUnrealVirtualizationToolApp();
|
|
~FUnrealVirtualizationToolApp();
|
|
|
|
EInitResult Initialize();
|
|
bool Run();
|
|
|
|
private:
|
|
|
|
void PrintCmdLineHelp() const;
|
|
|
|
bool TrySubmitChangelist(const TArray<FString>& DescriptionTags);
|
|
|
|
bool TryLoadModules();
|
|
bool TryInitEnginePlugins();
|
|
bool TryConnectToSourceControl();
|
|
|
|
EInitResult TryParseCmdLine();
|
|
EInitResult TryParseChangelistCmdLine(const TCHAR* CmdLine);
|
|
EInitResult TryParsePackageListCmdLine(const TCHAR* CmdLine);
|
|
|
|
bool TryParseChangelist(TArray<FString>& OutPackages);
|
|
bool TryParsePackageList(TArray<FString>& OutPackages);
|
|
|
|
bool TrySortFilesByProject(const TArray<FString>& Packages);
|
|
|
|
bool TryFindProject(const FString& PackagePath, FString& ProjectFilePath, FString& PluginFilePath) const;
|
|
|
|
FProject& FindOrAddProject(const FString& ProjectFilePath);
|
|
|
|
private:
|
|
|
|
/** Override used to suppress log messages */
|
|
TUniquePtr<FFeedbackContext> OutputDeviceOverride;
|
|
|
|
/** The source control provider that the tool uses */
|
|
TUniquePtr<ISourceControlProvider> SCCProvider;
|
|
|
|
/** Pointer to the changelist that should be submitted */
|
|
FSourceControlChangelistPtr ChangelistToSubmit;
|
|
|
|
/** Data structure holding the files in the changelist sorted by project and then by plugin*/
|
|
TArray<FProject> Projects;
|
|
|
|
/** Name of the client spec (workspace) passed in on the command line*/
|
|
FString ClientSpecName;
|
|
|
|
/** The mode for the application to run */
|
|
EMode Mode = EMode::Unknown;
|
|
|
|
/** Bitfield control the various options that should be run */
|
|
EProcessOptions ProcessOptions = EProcessOptions::Virtualize;
|
|
|
|
/** The number of the changelist being submitted, used with EMode::Changelist */
|
|
FString ChangelistNumber;
|
|
|
|
/** The path to the list of packages to virtualized, used with EMode::PackageList */
|
|
FString PackageListPath;
|
|
};
|
|
|
|
} //namespace UE::Virtualization
|