Cannot genereate project files for low-level test target due to EditorWidgets dependency in GeometryFramework

Hello,

I am trying to add explicit Low-Level Tests for a game project. I have added the Build.cs and Target.cs files in accordance with the instructions, but project file generation fails due to an exception:

Exception while generating include data for GameLowLevelTests: Unable to instantiate module 'UnrealEd': Unable to instantiate UnrealEd module for non-editor targets.
(referenced via Target -> GameLowLevelTests.Build.cs -> Game.Build.cs -> GeometryFramework.Build.cs -> EditorWidgets.Build.cs)

This initially perplexed me; how could we generate project files for our game module (another non-editor target)? The answer turned out to be that GeometryFramework.Build.cs will include the EditorWidgets module for both Editor and Program targets; since Low-Level Tests are Program targets, they end up with the module as well, even if the tests aren’t dependent on the editor.

Based on the commit message on GitHub, the reason why Program targets are included in the condition is to make ChaosVD include the module when it is built as a standalone program; I assume the knock-on effect of having low-level test targets also include it was unintentional. Is there some way to fix the latter without compromising the former?

Steps to Reproduce

  1. Add “GeometryFramework” as a module dependency to a Game module.
  2. Create an explicit low-level test target (in /Game/Source/Programs/[ModuleName]/) and add the Game module as a dependency.
  3. Run GenerateProjectFiles.bat
  4. Project file generation should fail with the following message:
Exception while generating include data for GameLowLevelTests: Unable to instantiate module 'UnrealEd': Unable to instantiate UnrealEd module for non-editor targets.
(referenced via Target -> GameLowLevelTests.Build.cs -> Game.Build.cs -> GeometryFramework.Build.cs -> EditorWidgets.Build.cs)

Hi Love Arvidsson,

For future reference, the condition “Target.Type == TargetType.Program” that you mentioned was added by CL 32844991 (commit 915d52e on GitHub). And indeed, this seems to be an oversight that affected low-level test targets unintentionally.

Note that low-level test targets may or may not have Editor dependencies depending on the type of what is being tested, and they will automatically set “Target.bCompileAgainstEditor” to reflect that.

The good news is that the issue seems to have been fixed in the main source branch very recently. If you want to cherry-pick it, you can find it on CL 47758692 (commit 00fe7e8 on GitHub). Basically, in file “GeometryFramework.Build.cs”, you simply have to change the current conditional:

if (Target.Type == TargetType.Editor || Target.Type == TargetType.Program)with this more appropriate one:

if (Target.bCompileAgainstEditor)Please let me know if that works!

Best regards,

Vitor

Hi Vitor,

Thank you for pointing me toward that commit! I’d only checked the release branch, so I missed that the issue had already been solved on main. I tried the change locally, and it has indeed solved the problem, so we’ll cherry-pick it into our engine. Thanks for the help!