Build wrapper not working for an entire project or folder


I started to work with SonarQube recently and it all went really smooth until I encounter an issue, I started searching online I didn’t found a solution, so, I’m posting here. :slight_smile:

I’m using the 8.9 LTS version of SonarQube and of SonarScanner. My project is being build using Bazel, and the source code is C/C++, we have the version of SonarQube that includes the SonarCFamily.

So, setting everything up was quite easy and forward, I even got the build wrapper done to a testing target, sonar scanner worked well and uploaded the data to SonarQube.

The problem appeared when I tried to analyze more than one target, specially the entire project.


build-wrapper-linux-x86-64 bazel --batch build -spawn_strategy=local --strategy=Genrule=local //my_project/some_folder:single_target

build-wrapper-linux-x86-64 bazel --batch build -spawn_strategy=local --strategy=Genrule=local – //my_project/some_folder:single_target //my_project/some_folder:another_single_target

These work fine, build wrapper works, sonar scanner gathers everything and uploads to SonarQube.

But this:

build-wrapper-linux-x86-64 bazel --batch build -spawn_strategy=local --strategy=Genrule=local //my_project/some_folder/…

Makes the build fail during the build wrapper phase.

When it comes to the project, we need some extra bazel flags:

build-wrapper-linux-x86-64 bazel --batch build -spawn_strategy=local --instrumentation_filter=[/:] --cxxopt=-Wno-error=disabled-optimization --config=host_gcc8 --strategy=Genrule=local //my_project/…

This also fails.

I tried to point to the targets as “//…”, “//my_project/…:*”, “:all”, and everything I found about building all the targets, nothing worked…

I now the project is being build, the build wrapper works with a single target, but it fails when I point to a folder, or project.

Is this a build wrapper limitation? Or should I do something different when it comes to use build wrapper for an entire project or folder?

Thank you!


Hi @AlexSoares ,

if you run bazel --batch build -spawn_strategy=local --strategy=Genrule=local //my_project/some_folder/… alone, does it succeed?

Sorry for the late reply. We realized that our project could not be built using the flags necessary to generate the build-wrapper, -spawn_strategy. We ended up using an internal solution. We already have uploaded data to SonarQube.
We have, however, another issue but, since it’s not related to this, I will create another topic.
Thank you!