UBT GenerateClangDatabase is NOT incremental and recreates whole compile_commands.json each time

dzemzmcdonalda
Wed, 04 Sep 2024 17:00:07 +0000
Platform & Builds

Hi,

In order to generate compile_commands.json for clangd Language Server, one can use -mode=GenerateClangDatabase flag in Unreal Build Tool (more details described here )

However, a problem with this mode is that it isn’t “incremental” which means it regenerates whole file every time, not only the part that requires it, resulting in very long execution times (around 45sec on my machine).

This makes it pretty hard to use since database needs to be regenerated when any #include directive has changed or when any source file has been added/removed/renamed. This should pretty much run every time when build process is invoked, just to make sure database is up to date.

Is there some hidden option/flag that makes it incremental?
Is there a reason why it’s NOT incremental?
Was it incremental in the past?

My engine version is 5.4.2, built from git on Linux

5 posts - 2 participants