Files
UnrealEngineUWP/Engine/Source/Programs/UnrealFrontend/Private/UnrealFrontendMain.cpp

99 lines
2.6 KiB
C++
Raw Normal View History

// Copyright Epic Games, Inc. All Rights Reserved.
#include "UnrealFrontendMain.h"
#include "RequiredProgramMainCPPInclude.h"
#include "StatsConvertCommand.h"
#include "StatsDumpMemoryCommand.h"
#include "UserInterfaceCommand.h"
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
#include "LaunchFromProfileCommand.h"
IMPLEMENT_APPLICATION(UnrealFrontend, "UnrealFrontend");
/**
* Platform agnostic implementation of the main entry point.
*/
int32 UnrealFrontendMain( const TCHAR* CommandLine )
{
Copying //UE4/Dev-Core to //UE4/Main ========================== MAJOR FEATURES + CHANGES ========================== Change 2717513 on 2015/10/06 by Robert.Manuszewski@Robert_Manuszewski_EGUK_M1 GC and WeakObjectPtr performance optimizations. - Moved some of the EObjectFlags to EInternalObjectFlags and merged them with FUObjectArray - Moved WeakObjectPtr serial numbersto FUObjectArray - Added pre-allocated UObject array Change 2716517 on 2015/10/05 by Robert.Manuszewski@Robert_Manuszewski_EGUK_M1 Make SavePackage thread safe UObject-wise so that StaticFindObject etc can't run in parallel when packages are being saved. Change 2721142 on 2015/10/08 by Mikolaj.Sieluzycki@Dev-Core_D0920 UHT will now use makefiles to speed up iterative runs. Change 2726320 on 2015/10/13 by Jaroslaw.Palczynski@jaroslaw.palczynski_D1732_2963 Hot-reload performance optimizations: 1. Got rid of redundant touched BPs optimization (which was necessary before major HR fixes submitted earlier). 2. Parallelized search for old CDOs referencers. Change 2759032 on 2015/11/09 by Graeme.Thornton@GThornton_DesktopMaster Dependency preloading improvements - Asset registry dependencies now resolve asset redirectors - Rearrange runtime loading to put dependency preloads within BeginLoad/EndLoad for the source package Change 2754342 on 2015/11/04 by Robert.Manuszewski@Robert_Manuszewski_Stream1 Allow UnfocusedVolumeMultiplier to be set programmatically Change 2764008 on 2015/11/12 by Robert.Manuszewski@Robert_Manuszewski_Stream1 When cooking, don't add imports that are outers of objects excluded from the current cook target. Change 2755562 on 2015/11/05 by Steve.Robb@Dev-Core Inline storage for TFunction. Fix for delegate inline storage on Win64. Some build fixes. Visualizer fixes for new TFunction format. Change 2735084 on 2015/10/20 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec CrashReporter Web - Search by Platform Added initial support for streams (GetBranchesAsListItems, CopyToJira) Change 2762387 on 2015/11/11 by Steve.Robb@Dev-Core Unnecessary allocation removed when loading empty files in FFileHelper::LoadFileToString. Change 2762632 on 2015/11/11 by Steve.Robb@Dev-Core Some TSet function optimisations: Avoiding unnecessary hashing of function arguments if the container is empty (rather than the hash being empty, which is not necessarily equivalent). Taking local copies of HashSize during iterations. Change 2762936 on 2015/11/11 by Steve.Robb@Dev-Core BulkData zero byte allocations are now handled by an RAII object which owns the memory. Change 2765758 on 2015/11/13 by Steve.Robb@Dev-Core FName::operator== and != optimised to be a single comparison. Change 2757195 on 2015/11/06 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec PR #1305: Improvements in CrashReporter for Symbol Server usage (Contributed by bozaro) Change 2760778 on 2015/11/10 by Jaroslaw.Surowiec@Stream.1.JarekSurowiec PR #1725: Fixed typos in ProfilerCommon.h; Added comments (Contributed by BGR360) Also fixed starting condition. Change 2739804 on 2015/10/23 by Robert.Manuszewski@Robert_Manuszewski_Stream1 PR #1470: [UObjectGlobals] Do not overwrite instanced subobjects with ones from CDO (Contributed by slonopotamus) Change 2744733 on 2015/10/28 by Steve.Robb@Dev-Core PR #1540 - Specifying a different Saved folder at launch through a command line parameter Integrated and optimized. #lockdown Nick.Penwarden [CL 2772222 by Robert Manuszewski in Main branch]
2015-11-18 16:20:49 -05:00
// Override the stack size for the thread pool.
FQueuedThreadPool::OverrideStackSize = 256 * 1024;
FCommandLine::Set(CommandLine);
FString Command;
FString Params;
FString NewCommandLine = CommandLine;
// process command line parameters
bool bRunCommand = FParse::Value(*NewCommandLine, TEXT("-RUN="), Command);
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
if (Command.IsEmpty())
{
GLog->Logf(ELogVerbosity::Warning, TEXT("The command line argument '-RUN=' does not have a command name associated with it."));
}
if (bRunCommand)
{
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
// extract off any '-PARAM=' parameters so that they aren't accidentally parsed by engine init
FParse::Value(*NewCommandLine, TEXT("-PARAMS="), Params);
if (Params.Len() > 0)
{
// remove from the command line & trim quotes
NewCommandLine = NewCommandLine.Replace(*Params, TEXT(""));
Params = Params.TrimQuotes();
}
}
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
// Add -Messaging if it was not given in the command line.
if (!FParse::Param(*NewCommandLine, TEXT("MESSAGING")))
{
NewCommandLine += TEXT(" -Messaging");
}
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
// Add '-Log' if the Frontend was run with '-RUN=' without '-LOG' so we can read any potential log output.
if (bRunCommand && !FParse::Param(*NewCommandLine, TEXT("LOG")))
{
NewCommandLine += TEXT(" -Log");
}
// initialize core
GEngineLoop.PreInit(*NewCommandLine);
FModuleManager::Get().StartProcessingNewlyLoadedObjects();
bool Succeeded = true;
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
// Execute desired command
// To execute, run with '-RUN="COMMAND_NAME_FOUND_BELOW"'.
// NOTE - Some commands may require extra command line parameters.
if (bRunCommand)
{
if (Command.Equals(TEXT("CONVERT"), ESearchCase::IgnoreCase))
{
FStatsConvertCommand::Run();
}
else if( Command.Equals( TEXT("MEMORYDUMP"), ESearchCase::IgnoreCase ) )
{
FStatsMemoryDumpCommand::Run();
}
[AUTOMERGE] This submission allows the end user to launch onto any platform using a profile created inside of the UFE. Allows for easier scripting for testing and launching your project. To run: UnrealFrontend.exe -Run="LAUNCHPROFILE" -PROFILENAME="THE_NAME_OF_YOUR_CUSTOM_PROFILE" **Changes and Additions** Added LaunchFromProfileCommand.h/.cpp --Checks if '-ProfileName=' is used and is correct. --Loads the LaucherServicesModules and DeviceServicesModules ----Gets the Device Proxy Manager ----Gets the Profile Manager which is needed to find the named profile. --A launcher is created that uses the profile and DeviceProxyManager to read the profile and trigger a build, cook, and launch of it. --Logging from the launch will be shown in the command window. --Keeps running until the launcher broadcasts that it has either completed or has been cancelled. UnrealFrontendMain.cpp Task Related: --Added the launch profile command to the command if/else statement. --Added helpful comments. Improvements and General Fixes: --Added a check to verify that a command is actually given with -Run. Logs a warning if none exist. --Fixed an issue where the -messaging command line check was returning incorrectly. It will now only add '-messaging' if it actually does not exist in the command line already. --Added a command line check where if you run with -run then -log will be appended to the command line if it isn't already. This allows us to receive logging onscreen. #CodeReview: adric.worley, justin.hair, marcus.wassmer, jason.bestimt, bob.ferreira, ben.salem, brad.angelcyk -------- Integrated using branch UE4-Orion-To-UE4 of change#2675868 by Justin.Hair on 2015/09/01 14:50:30. [CL 2680596 by Justin Hair in Main branch]
2015-09-04 12:55:44 -04:00
// The 'LAUNCHPROFILE' command also needs '-PROFILENAME="MY_PROFILE_NAME"' as a command line parameter.
else if (Command.Equals(TEXT("LAUNCHPROFILE"), ESearchCase::IgnoreCase))
{
FLaunchFromProfileCommand* ProfileLaunch = new FLaunchFromProfileCommand;
ProfileLaunch->Run(Params);
}
}
else
{
FUserInterfaceCommand::Run();
}
// shut down
FEngineLoop::AppPreExit();
FModuleManager::Get().UnloadModulesAtShutdown();
return Succeeded ? 0 : -1;
}