C++ analysis for variants built in Docker

I have a follow up question on

but it was already closed.

I want to analyze C++ source-code that has multiple variants. Meaning parts of the code is flagged with #ifdef.
With the provided solution in above mentioned question, I am able to create a build-script, build all the variants inside the script, wrapped with the build-wrapper and then start the analysis.

Now I want to build each of those variants inside a Docker container, using docker build followed by docker run.
When invoking docker commands inside the build-script, the build inside Docker is ignored - which is understandable.

Is there any solution for this?
Something like combining the output of two build-wrappe’d builds and then scan them together.


Hi @tiolan,

unfortunately there is not, analysis and build should happen at the same OS level, if two builds requires 2 different environments inside 2 different containers it is not going to work.

This is a pity. We are facing the same challenge. We build the software in parallel in 16 different containers. 4 different customers, 2 different operating systems, 2 different CPU architectures (x64 and arm).
(4x2x2 = 16).

It would be really helpful, if I could pass a “build id” as a parameter to sonar-scanner and then the reports would be merged server-side. Or a local export-and-merge and then a second run of the scanner that does no scan but sends the merged data to the cloud.

Is such feature planned?

Hi @sebastian-freitag

thank you for your feedback, we are aware of the use-case.

For now, we have nothing planned regarding the multi-configuration analysis.