Use DOTNET_STARTUP_HOOKS and Harmony to hotpatch UBT and UAT, and add support for Kubernetes-based UBA #35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently UET intercepts progress information by pretending to be XGE via OpenGE, which allows us to write better progress information to the terminal. Since Unreal Engine 5.4 though, Epic provides the Unreal Build Accelerator which is a replacement to XGE (and OpenGE). Not only do we want to be able to leverage UBA from UET (and distribute builds), but we need to plan for a future where XGE support is removed from the Unreal tooling since UBA exists and is recommended by Epic.
Because we can no longer pretend to be
xgConsoleand execute the graph ourselves, we instead need to hotpatch UBT so we can get at the internals ofActionGraphandImmediateActionQueue, and forward all of the data we care about back to the main UET process.DOTNET_STARTUP_HOOKSand using Harmony 2 will work.ImmediateActionQueueconstructor to retrieve total task information.ImmediateActionQueue.SetActionStateto determine when an action's status has changed.ImmediateActionQueue.TryStartOneActionInternalwith a transpiler patch to determine when actions start and when actions error.ImmediateActionQueue.RunTillDoneso we know when the queue is complete.ImmediateActionQueueto work so we can get progress.Redpoint.Uet.Patching.Loaderproject, which will replaceRedpoint.Uet.OpenGE.Redpoint.Uet.Patching.Loader.csprojto bundle the output ofRedpoint.Uet.Patching.Runtimeand it's dependencies into an embedded resource.Redpoint.Uet.Patching.Loaderto extract the bundle at runtime.Redpoint.Uet.Patching.Loaderto setDOTNET_STARTUP_HOOKSto point at the extractedRedpoint.Uet.Patching.Loader.dllfile.Redpoint.Uet.Patching.RuntimeandRedpoint.Uet.Patching.Loaderfor passing job progress.Redpoint.Uet.Patching.Runtimeto pass the information collected from hotpatches back to the loader over gRPC, and then emit logging information similar toLogInterceptingDispatcher.We should then also replace the
Redpoint.Uet.BuildPipelinepatching code with Harmony, and avoid recompiling DLLs. This should make engine builds start much faster, and allow us to turn on UEFS-unmount-after-build to ensure cleaner build environments (currently we keep engines mounted because the .NET rebuild is too slow).AutomationTool, patch inBUILD_GRAPH_PROJECT_ROOTsupport.AutomationTool, patch inBUILD_GRAPH_ALLOW_MUTATIONsupport.AutomationTool, patch script file loading so that scripts can be referenced outside the engine directory.AutomationTool, patchbRemoteto exclude BuildGraph targets that we know won't work with it.AutomationTool, patch outrobocopy-based file copies since it's unreliable.EpicGames.BuildGraph, patchSwitchhandling so that it isn't broken with unexpected fallthroughs happening (this is fixed on modern engines, but broken for 5.0).UnrealBuildTool, patchSingleInstanceMutexso thatuebp_UATMutexNoWaitcan be used to skip it.EpicGames.Build, patchWritableEngineDirectoryso that includes the process ID in theUnrealEnginefolder name.UnrealBuildTool, patchUEDeployAndroidto fix directory name handling when paths include.uetfor Gradle execution.