LiveCoding: Prevent object files being overwritten during a live coding compile. Object files are now built with a .lc suffix, leaving the original files intact. This ensures it can gather COFF data from the correct executables on relaunch, and means that any existing changes will be patched in as soon as the first Live Coding compile is initiated. Should fix several issues.

#rb none
#jira UE-76940, UE-76993, UE-76943

[CL 7321451 by Ben Marsh in 4.23 branch]
This commit is contained in:
Ben Marsh
2019-07-16 08:51:28 -04:00
parent 898ddec0b4
commit 53b519f30c
7 changed files with 296 additions and 99 deletions

View File

@@ -397,6 +397,16 @@ namespace
}
// BEGIN EPIC MOD - Allow mapping from object files to their unity object file
static void AddCompilandId(types::StringMap<uint32_t>& objFileToCompilandId, const std::wstring& objFile, uint32_t compilandId)
{
std::wstring WideObjectFile = file::NormalizePath(objFile.c_str());
ImmutableString ObjectFile = string::ToUtf8String(WideObjectFile);
if (objFileToCompilandId.find(ObjectFile) == objFileToCompilandId.end())
{
objFileToCompilandId.insert(std::make_pair(ObjectFile, compilandId));
}
}
static bool ReadLiveCodingInfo(const wchar_t* manifestFile, types::StringMap<uint32_t>& objFileToCompilandId)
{
// Read the file to a string
@@ -441,12 +451,11 @@ namespace
return false;
}
std::wstring WideObjectFile = file::NormalizePath((BaseDir + L"\\" + *SourceFileValue->AsString()).c_str());
ImmutableString ObjectFile = string::ToUtf8String(WideObjectFile);
if (objFileToCompilandId.find(ObjectFile) == objFileToCompilandId.end())
{
objFileToCompilandId.insert(std::make_pair(ObjectFile, UnityCompilandId));
}
std::wstring objFile = BaseDir + L"\\" + *SourceFileValue->AsString();
AddCompilandId(objFileToCompilandId, objFile, UnityCompilandId);
std::wstring patchedObjFile = file::RemoveExtension(objFile) + L".lc.obj";
AddCompilandId(objFileToCompilandId, patchedObjFile, UnityCompilandId);
}
}