Build wrapper error in Swift analysis after Sonarqube 8.0 upgrade

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Fastlane: 2.134.0

  • what are you trying to achieve

We currently have a Developer edition instance of sonarqube running on the newly released 8.0-developer-beta docker image. We use fastlane to compile a swift project using the following command;

xcargs: "-project 'Component Interface.xcodeproj'"

and then call the sonar-scanner via fastlane;

project_configuration_path: "",
sources_path:  File.expand_path("../Component Interface")

This previously worked on Sonar 7.8, however since upgrading to 8.0 we are now getting the following error;

The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that:

  • you are using the latest version of the build-wrapper and the SonarCFamily analyzer
  • you are correctly invoking the scanner with correct configuration * your compiler is supported
  • you are wrapping your build correctly
  • you are wrapping a full/clean build
  • you are providing the path to the correct build-wrapper output directory
  • what have you tried so far to achieve this

I have confirmed that the build-wrapper-dump.json is not empty, the path is correct, redownloaded the wrapper from our SonarQube instance, and cleared the build-cache for Xcode before running another build but none of these resolved the issue.

The fact that this previously worked has me confused as we have not changed anything on our side as to how we are building the project.

Hi @Philip_Bradshaw,

as you mentioned it is a swift project, do you have any C/C++/Objective-C file in your project that you would like to analyze?

Hi @mpaladin,

Apologies for the late reply. We were able to resolve it ourselves. The project in question was purely a Swift project and we added the following properties to tell Sonar to ignore any C/Obj-C files;

This resolved the issue and sonar was no longer failing to scan the project. I haven’t tested using the sonar.language=swift property instead.

For our own understanding, was there a change made that caused this change in behaviour or were we just lucky that this previously worked for pure swift projects?

Hi @Philip_Bradshaw,

if your project is containing only Swift files why were you using build-wrapper?

The project had previously contained some Obj-C code in it. We also misunderstood what the build-wrapper was required for and believed it was needed for swift code as well.

Hi @Philip_Bradshaw,

thank you for your feedback, we are going to look at improving our documentation.