UE5.1 Very Long Build Times

We are developing a plugin and have recently moved our QA from testing primarily using a 5.0 version of the plugin / sample application to 5.1. When we moved the build server to build 5.1, the build times to build both the plugin and the application went from 2 hours to 11 hours. The most striking thing I’ve noticed in the build logs is that it is now recompiling UnrealHeaderTool every time. In fact, it’s building it twice before compiling the main project - once Using VS 2022 and then again on VS 2019. I’m only guessing that recompiling UHT means the project needs a full rebuild, and I’m looking to prevent UHT from recompiling every day.

The thing that I thought might be causing it was this:

    [Upgrade] Using backward-compatible include order. The latest version of UE has changed the order of includes, which may require code changes. The current setting is:
    [Upgrade]     IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_0
    [Upgrade] Suppress this message by setting 'IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1;' in CavrnusEditor.Target.cs.
    [Upgrade] Alternatively you can set this to 'EngineIncludeOrderVersion.Latest' to always use the latest include order. This will potentially cause compile errors when integrating new versions of the engine.

However, modifying our Editor.Target.cs as suggested only succeeded in eliminating this message. Any suggestions on how to stop UHT from recompiling itself and the project every time would be greatly appreciated.

Seems like this was a side effect of packaging the plugin and packaging the project in the same workspace / folder. The combined server job that made both the 5.1 Application and Plugin was taking over 11h. Now that they’ve been separated, the App can take under 1h, and the Plugin takes just over 3h.

how did you modify your target.cs file? I open it up in visual studio, but I don’t see the setting includeorderversion=. How to add?

Hi, here is the class definition in our Editor.Target.cs file.

public class <ProjectName>EditorTarget : TargetRules
{
	public <ProjectName>EditorTarget( TargetInfo Target) : base(Target)
	{
		Type = TargetType.Editor;
		bUseUnityBuild = false;
		WindowsPlatform.bStrictConformanceMode = true;
        DefaultBuildSettings = BuildSettingsVersion.Latest;
		ExtraModuleNames.AddRange( new string[] { "<ProjectName>" } );
#if UE_5_1_OR_LATER
		IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
#endif
	}
}

In general I don’t think we actually need to disable unity building, but I think this was left over for editor compilation from a time that we didn’t support unity builds. I don’t think should affect shipping product. I believe we scoped this to 5.1 or later because “IncludeOrderVersion” wasn’t a field before that.