SonarQube incremental analysis with c++ build wrapper

I have a question about performing incremental analysis on C++ code using build wrapper.

What I can understand is after your build the build wrapper generates the build-wrapper-dump.json file which then gets used by the scanner to decide which files needs to be analysed. The issue with this is that it will only analyse the last built files.

The normal work flow for coding is we do many code changes and many builds locally in your workspace without running analysis. And at the end we want to do a sonar-scan. The sonar-scan will only analyse the last built files.

Is there a way for the scanner/build wrapper to analyse all built files since the last sonar-scan?

Hi @Kamal_Chandra,

as described in the documentation you are required to perform a full clean build to analyze your project to allow the analyzer to see all built files. If you are concerned about performance of full build you can always speed up your build in other ways, i.e. by using ccache.

So you are saying that incremental analysis is not supported?

Its not the build time I am worried about…incremental build is fully supported in our build system. But if we have to perform the full analysis each time that takes a very long time.

Hi @Kamal_Chandra,

it is supported in the latest version of the SonarCFamily plugin which is version 6.6:

You must perform a full clean build and to speed-up the build you persist a state between analysis so the analyzer will be analyzing changes only.

Thanks, I will update my installation and try it out.