[Regression] AddBuildProductsFromManifest missing [ModuleName]Classes.h in manifest during BuildGraph build

I believe this is a regression in CL 56607635 where the behaviour of PrepopulateDirectoryCache changed from:

outputFiles.Add(mi.ModuleName + “Classes.cpp”);

to:

outputFiles.Add(mi.ModuleName + “Classes.h”);

inside UHTExecution.cs. We started seeing this regression after we updated to the latest changes on the 5.8 stream.

BUILD FAILED: AddBuildProductsFromManifest: C:\UES\1lc5rxcomnt_ra\.uet\tmp\H\Plugins\P\Intermediate\Build\Linux\UnrealServer\Inc\RECFG\UHT\RedpointEOSConfigClasses.h was in manifest "C:\UES\b34bjau2jf2_6f\Engine\Intermediate\Build\Manifest.xml" but could not be found.

After patching to the previous behaviour of “Classes.cpp”, BuildGraph can build the module successfully. Interestingly, “RedpointEOSConfigClasses.cpp” also does not exist on disk, but BuildGraph doesn’t complain about it being missing.

It looks like UHT only emits a “Classes.h” file is UhtPackageCodeGeneratorHFile is added to the factory in UhtCodeGenerator.cs. The writeHeader variable is conditional on whether the header file contains any UHT classes:

					if (!writeHeader)
					{
						foreach (UhtType type in headerFile.Children)
						{
							if (type is UhtClass classObj)
							{
								if (classObj.ClassType != UhtClassType.NativeInterface &&
									classObj.ClassFlags.HasExactFlags(EClassFlags.Native | EClassFlags.Intrinsic, EClassFlags.Native) &&
									!classObj.ClassExportFlags.HasAllFlags(UhtClassExportFlags.NoExport))
								{
									writeHeader = true;
									break;
								}
							}
						}
					}

						if (writeHeader)
						{
							new UhtPackageCodeGeneratorHFile(this, module).Generate(factory, moduleSortedHeaders);
						}

This matches the behaviour we’re seeing where it’s only an error in a module that only contains UENUM declarations.

If the change to “Classes.h” is intended, then UHT needs to be updated to always write this file, instead of only emitting it when UCLASS is present in a module.

[Attachment Removed]

Steps to Reproduce

  • Create a C++ module that contains only UENUM() declarations (no UCLASS)
  • Build with BuildGraph
  • Observe an error due to [ModuleName]Classes.h missing from the UHT folder
    [Attachment Removed]

I’m working on a 5.8 hotfix change to address this

[Attachment Removed]