colcon / colcon-cmake

Extension for colcon to support CMake packages
http://colcon.readthedocs.io
Apache License 2.0
16 stars 25 forks source link

Workspace-level "compile_commands.json" is being generated by "colcon test" #81

Closed mm318 closed 3 years ago

mm318 commented 4 years ago

It looks like the new CompileCommandsEventHandler (introduced by https://github.com/colcon/colcon-cmake/pull/69) is being invoked by colcon test.

For example, if you do

colcon build --event-handlers compile_commands- --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
colcon test  # don't specify any --event-handlers options

there will still end up being a workspace-level compile_commands.json under build/.

Is this intended behavior? I think it's more intuitive if the workspace-levelcompile_commands.json is only generated during colcon build.

dirk-thomas commented 4 years ago

I think it's more intuitive if the workspace-level compile_commands.json is only generated during colcon build.

I agrees that regenerating the file is only necessary during build but not test. Unfortunately the event handlers have no way to determine what verb was used and there is no event type which would distinguish a build from a test at the moment.