How Necessary are BUILT_FROM_CHANGELIST and BUILD_VERSION in Resource Files?
We've been investigating ways to improve the speed of our iterative engine builds, and have found that the vast, vast majority of build times come from recompiling Default.rc2 and relinking every module, since BUILD_VERSION and BUILT_FROM_CHANGELIST have changed since the last build. By commenting out the lines in UEBuildBinary.cs that define these macros (809-810 in UE5.2.1), we've seen no-change UnrealGame and UnrealEditor build action counts fall from 667 down to just 10-20.
Upon investigation, it appears that these macros are only in use in the HoloLens crash reporter (which seems like a mistake, the BuildSettings module should be used instead I believe?), and:
- BUILT_FROM_CHANGELIST is used in Source/Runtime/Launch/Resources/Version.h to add to ENGINE_VERSION_STRING iff BRANCH_NAME is also defined, which only is in the BuildSettings module. Because BuildSettings also defines BUILT_FROM_CHANGELIST (which I have no intention of changing), this global define is never actually used.
- BUILD_VERSION is used to populate ProductVersion in Default.rc2, but it seems that the always-existing ENGINE_VERISON_STRING mentioned above could be used as a substitute without losing much context.
It does appear as though UGS also defines these when Options.UseFastModularVersioningV2 is false. Since we have no reason to disable that setting, I'm not really sure how disabling these in UEBuildBinary would affect other customers using older versioning schemes.
With all of that context, are there any drawbacks to disabling these defines in UEBuildBinary.cs, aside from slight loss of precision in module ProductVersions? Or could this be disabled with a BuildConfiguration setting/flag? This seems like a huge build-time win for a very small cost.
I did some investigation myself before I went on break and noticed the same thing, as far as I'm aware the engine doesn't actually use the changelist that is embedded in the resource file (and if it does it should probably be using the version from the BuildSettings module). Some more investigation will be required but I believe that I can remove this embedded version and stop requiring all the resource files to rebuild which also requires all the dlls to relink.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-195983 in the post.