TL;DR - It sure would be nice if someone contributed support for JSON Compilation Database to Unreal Build Tool. Until then, here's what you can do:
- Install a patched version of Bear from https://github.com/TTimo/Bear/tree/ttimo (note: ttimo branch)
- From a clean UE4 tree, capture a compilation database:
bear -o ./UE4Game.json ./Engine/Build/BatchFiles/Linux/Build.sh UE4Game Linux Development -disableunity -nopch - Create a Sourcetrail project, C/C++ from Compilation Database. Add Engine/ to the Header Files & Directories to Index, no other changes needed (my project).
- Index, wait for a while .. and voila!
Software:
- Unreal Engine 4.20 source from github
- Sourcetrail 2018.3.55
Stats:
- Indexing took 1h40 on an AMD threadripper 1950X, configured with 16 indexer threads, peaked to around 50GB RAM usage.
- Database is 7.6GB on disk, 12k files indexed.
Discussion:
The current release of bear has two issues that will prevent it from capturing an UE4 compile, hence my fork: https://github.com/rizsotto/Bear/issues/194 and https://github.com/rizsotto/Bear/pull/224. Other than that the tool is pretty much perfect.
The database is large and queries against it are noticeably slower than with smaller projects. The indexing used to be in the 6+ hour range prior to Sourcetrail 2018.3.55, and new versions of ST allow you to index in the background, so there is great progress there.
I have not tried, but the same steps would likely work with UE4Editor, and result in an even larger database.
I don't use Sourcetrail with UE4 on Windows. Bear will not be applicable, I don't know if the Sourcetrail Visual Studio plugin will capture anything.
Comments