Compdb (compile_commands.json) Generator
Soong can generate compdb files. This is intended for use with editing tools such as YouCompleteMe and other libclang based completers.
compdb file generation is enabled via environment variable:
$ export SOONG_GEN_COMPDB=1
$ export SOONG_GEN_COMPDB_DEBUG=1
One can make soong generate a symlink to the compdb file using an environment variable:
$ export SOONG_LINK_COMPDB_TO=$ANDROID_HOST_OUT
You can then trigger an empty build:
$ make nothing
Note that if you build using mm or other limited makes with these environment variables set the compdb will only include files in included modules.
It will generate in out/soong/development/ide/compdb/compile_commands.json
Merge multiple command_commands.json
compile-commands 2.0.0 pip install compile-commands
compile-commands --files myproject1/build/compile_commands.json myproject2/build/compile_commands.json --merge
The output file will named by default "compile_commands.json" in the current working directory. You can use -o, --output to override this behavior.