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.
I’m using the 8.9 LTS version of SonarQube and 18.104.22.1682 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.
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?