rizsotto / Bear

Bear is a tool that generates a compilation database for clang tooling.
GNU General Public License v3.0
4.76k stars 312 forks source link

Option to keep events.json? #446

Closed moyix closed 2 years ago

moyix commented 2 years ago

Would it be possible to add a flag or environment variable that tells bear to not remove the events.json after running citnames? This would be nice for my current use case, which is using bear to instrument Debian package builds for later analysis; if I want to add a new tool to citnames or tweak its config, etc., I'd rather not have to rebuild all of Debian again. The logfiles can be rather large but they compress well with gzip.

If you'd be interested in having this feature in bear, I can make a PR. I have already made a version of it that adds a --keep command line flag to bear, but if you'd prefer a different name or mechanism for setting the option (like an environment variable) it's easy enough to change. You can see that on my fork here: https://github.com/moyix/Bear/commit/960cff6aa0f9acad6ba8e3f8ee04f3fdbec9bd85

The test suite passes but I haven't added any new tests for the --keep flag. If you do want this PR, I can add a test or two before submitting the PR.

rizsotto commented 2 years ago

I thought this use case can be covered by running the intercept command. (And run the citnames afterwards.) Would that fit into your use case?

moyix commented 2 years ago

Doh, so it can! I completely missed that intercept is self-contained and can be run on its own :) I'll close this, thanks!