You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Live Coding: Fix several issues related to using launch on / packaged builds with Live Coding.
* The original .uproject file is now compiled into monolithic executables when Live Coding is enabled. This allows invoking UBT with the original project file when the executable is staged to a different directory. This parameter can be overriden via the LiveCoding.SourceProject cvar. * The original engine directory is also compiled into the executable. This allows finding the console executable path without having to enter it manually via the LiveCoding.ConsolePath cvar. * If an exact match for a binary filename is not found, try to find a match by name only. Also required to support staged builds for 'Launch On', etc... * Add a LiveCoding.Compile command to trigger a compile from the console. #rb none #jira UE-72677 #jira UE-72678 #jira UE-72683 [CL 6625676 by Ben Marsh in Dev-Build branch]
This commit is contained in:
@@ -23,6 +23,11 @@ bool GIsCompileActive = false;
|
||||
FString GLiveCodingConsolePath;
|
||||
FString GLiveCodingConsoleArguments;
|
||||
|
||||
#if IS_MONOLITHIC
|
||||
extern const TCHAR* GLiveCodingEngineDir;
|
||||
extern const TCHAR* GLiveCodingProject;
|
||||
#endif
|
||||
|
||||
FLiveCodingModule::FLiveCodingModule()
|
||||
: bEnabledLastTick(false)
|
||||
, bEnabledForSession(false)
|
||||
@@ -47,19 +52,42 @@ void FLiveCodingModule::StartupModule()
|
||||
ECVF_Cheat
|
||||
);
|
||||
|
||||
CompileCommand = ConsoleManager.RegisterConsoleCommand(
|
||||
TEXT("LiveCoding.Compile"),
|
||||
TEXT("Initiates a live coding compile"),
|
||||
FConsoleCommandDelegate::CreateRaw(this, &FLiveCodingModule::Compile),
|
||||
ECVF_Cheat
|
||||
);
|
||||
|
||||
#if IS_MONOLITHIC
|
||||
FString DefaultEngineDir = GLiveCodingEngineDir;
|
||||
#else
|
||||
FString DefaultEngineDir = FPaths::EngineDir();
|
||||
#endif
|
||||
#if USE_DEBUG_LIVE_CODING_CONSOLE
|
||||
static const TCHAR* DefaultConsolePath = TEXT("Binaries/Win64/LiveCodingConsole-Win64-Debug.exe");
|
||||
#else
|
||||
static const TCHAR* DefaultConsolePath = TEXT("Binaries/Win64/LiveCodingConsole.exe");
|
||||
#endif
|
||||
|
||||
ConsolePathVariable = ConsoleManager.RegisterConsoleVariable(
|
||||
TEXT("LiveCoding.ConsolePath"),
|
||||
FPaths::ConvertRelativePathToFull(FPaths::EngineDir() / DefaultConsolePath),
|
||||
FPaths::ConvertRelativePathToFull(DefaultEngineDir / DefaultConsolePath),
|
||||
TEXT("Path to the live coding console application"),
|
||||
ECVF_Cheat
|
||||
);
|
||||
|
||||
#if IS_MONOLITHIC
|
||||
FString SourceProject = (GLiveCodingProject != nullptr)? GLiveCodingProject : TEXT("");
|
||||
#else
|
||||
FString SourceProject = FPaths::IsProjectFilePathSet() ? FPaths::GetProjectFilePath() : TEXT("");
|
||||
#endif
|
||||
SourceProjectVariable = ConsoleManager.RegisterConsoleVariable(
|
||||
TEXT("LiveCoding.SourceProject"),
|
||||
FPaths::ConvertRelativePathToFull(SourceProject),
|
||||
TEXT("Path to the project that this target was built from"),
|
||||
ECVF_Cheat
|
||||
);
|
||||
|
||||
EndFrameDelegateHandle = FCoreDelegates::OnEndFrame.AddRaw(this, &FLiveCodingModule::Tick);
|
||||
|
||||
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings");
|
||||
@@ -105,7 +133,9 @@ void FLiveCodingModule::ShutdownModule()
|
||||
FCoreDelegates::OnEndFrame.Remove(EndFrameDelegateHandle);
|
||||
|
||||
IConsoleManager& ConsoleManager = IConsoleManager::Get();
|
||||
ConsoleManager.UnregisterConsoleObject(SourceProjectVariable);
|
||||
ConsoleManager.UnregisterConsoleObject(ConsolePathVariable);
|
||||
ConsoleManager.UnregisterConsoleObject(CompileCommand);
|
||||
ConsoleManager.UnregisterConsoleObject(EnableCommand);
|
||||
}
|
||||
|
||||
@@ -233,6 +263,14 @@ bool FLiveCodingModule::StartLiveCoding()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the source project filename
|
||||
FString SourceProject = SourceProjectVariable->GetString();
|
||||
if (SourceProject.Len() > 0 && !FPaths::FileExists(SourceProject))
|
||||
{
|
||||
UE_LOG(LogLiveCoding, Error, TEXT("Unable to start live coding session. Unable to find source project file '%s'."), *SourceProject);
|
||||
return false;
|
||||
}
|
||||
|
||||
UE_LOG(LogLiveCoding, Display, TEXT("Starting LiveCoding"));
|
||||
|
||||
// Enable external build system
|
||||
@@ -247,9 +285,9 @@ bool FLiveCodingModule::StartLiveCoding()
|
||||
Arguments += FString::Printf(TEXT("%s"), FPlatformMisc::GetUBTPlatform());
|
||||
Arguments += FString::Printf(TEXT(" %s"), EBuildConfigurations::ToString(FApp::GetBuildConfiguration()));
|
||||
Arguments += FString::Printf(TEXT(" -TargetType=%s"), FPlatformMisc::GetUBTTarget());
|
||||
if(FPaths::IsProjectFilePathSet())
|
||||
if(SourceProject.Len() > 0)
|
||||
{
|
||||
Arguments += FString::Printf(TEXT(" -Project=\"%s\""), *FPaths::ConvertRelativePathToFull(FPaths::GetProjectFilePath()));
|
||||
Arguments += FString::Printf(TEXT(" -Project=\"%s\""), *FPaths::ConvertRelativePathToFull(SourceProject));
|
||||
}
|
||||
LppSetBuildArguments(*Arguments);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user