jacobdufault / cquery

C/C++ language server supporting multi-million line code base, powered by libclang. Emacs, Vim, VSCode, and others with language server protocol support. Cross references, completion, diagnostics, semantic highlighting and more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trigger indexing using manually created compilation database

philip-n opened this issue · comments

We have the situation that multiple smaller, interlinked projects are developed and compiled separately, but depend on each other. There's some in-house tools for tasks like checking all projects out, compiling all required projects, etc.

I'd like to run cquery to (re-)index everything after check out and building (at this time, cmake has already created the compilation-commands.json in each project). This would allow to build/update the index whenever necessary, e.g. when a new developer machine is set up or when new features in loosely related repositories are pulled.

I can generate one big compilation database outside of the projects, using

cat ./**/build/compile_commands.json > compile_commands.json && sed -i -e ':a;N;$!ba;s/\]\n\n\[/,/g' compile_commands.json

(found here: https://github.com/cquery-project/cquery/wiki/Compilation-database#clang)

What I'm looking for is a way to manually (i.e. via shell) tell cquery to update its index using this compilation database, using something like cquery --update-index --use-compilation-db <path>.

I haven't found a way to do it - if this can already be achieved, I'd be grateful for hints!