Bear icon indicating copy to clipboard operation
Bear copied to clipboard

Incremental update of output compile_commands.json

Open KholdStare opened this issue 7 years ago • 7 comments

First of all, thanks for the tool!

I am wondering if it would be possible to have a commandline parameter that makes bear update the output compile_commands.json incrementally during the build instead of in one fell swoop at the end. I am using rtags and it listens to file updates to start indexing files. It would be nice to start the indexing process in parallel with the build itself, instead of waiting for the entire thing to complete.

Thoughts?

Thank you.

KholdStare avatar Aug 30 '16 04:08 KholdStare

thanks Alexander for the report. it's not impossible, but very different how the current implementation works... i presume rtags would expect the compile_command.json file is always be a valid JSON file. or how rtags does it consume the compilation database? if Bear would update the compilation database for each file, wouldn't rtag start to re-index the whole again and again? is it smart enough to recognize that the content changed by only a single file addition? can you test it, like touch compile_commands.json every second and see that it does the re-indexing or not?

rizsotto avatar Aug 30 '16 13:08 rizsotto

This would also be useful for better handling of Ctrl-C. Currently all output is lost if the build process is interrupted. Make it as an option?

klimkin avatar Aug 31 '16 19:08 klimkin

dealing with ctrl-c might be a separate issue. you are right it is desirable. any update on rtags indexing behavior?

rizsotto avatar Aug 31 '16 20:08 rizsotto

rtags monitors file-system events, and checks for changes in the compile_commands.json file. As a test I manually removed and added a single entry from the json with vim, saving the file after each operation. I saw rdm (the indexing server) reindex the corresponding c++ file when I added it back. It seems to be smart enough to diff.

KholdStare avatar Aug 31 '16 20:08 KholdStare

Hi, first of all, thanks for this tool guys!!

I've just release a tool (based onYCM-generator/Bear), which basically process build log outputs and generate the corresponding compilation database file. The idea is to be faster (doesn't need a clean build or even an actual build) and more "cross-compilation friendly". I've used it successfully to index some large AOSP modules in ~1 minute and used its output with tools like YouCompleteMe, Deoplete and Rtags.

Feel free to try it out, open issues/feature requests and send PRs :)

https://github.com/nickdiego/compiledb-generator

Thanks, Nick

nickdiego avatar Aug 03 '17 00:08 nickdiego

Kindly asking for any progress~

tristone13th avatar Sep 02 '22 01:09 tristone13th

@tristone13th no progress unfortunately.

rizsotto avatar Sep 02 '22 02:09 rizsotto