Hussain Mansoor
Hussain Mansoor

Reputation: 3134

SonarQube 7.4 scanning ObjectiveC using fastlane

I have many iOS projects with both ObjectiveC and Swift code. I'm using SonarQube 7.4 server and using Fastlane for build, test, scan and deploy. Everything was working fine for 1+ year and suddenly sonar-scanner starts failing with below error:

INFO: Sensor CFamily [cpp]
ERROR: The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper
and setting the property "sonar.cfamily.build-wrapper-output", but it was not specified.
If you don't want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-

I tried build-wrapper on one of my projects and it starts giving my compilation errors. Fastlane Gym works fine though. So instead of figuring all this out, is there a plugin in Fastlane for this? Or any way I can ignore this build-wrapper? (It was working fine & stopped suddenly so not sure if it's 'really' an issue)

Upvotes: 1

Views: 1482

Answers (1)

Hussain Mansoor
Hussain Mansoor

Reputation: 3134

The solutions is quite funny as the functionality of SonarQube scanner is broken (or with bugs). I created a new project and used build-wrapper to build my project. It created 2 files in a directory

  • bw_output/
    • build-wrapper-dump.json
    • build-wrapper.log

Content of build-wrapper-dump.json is

{"version":0,
"captures":[]}

I used this file for my other projects and sonar-scanner worked for all. So it looks like that solution for the above problem is to just commit these 2 files and update sonar-project.properties like below:

sonar.cfamily.build-wrapper-output=bw_output
#sonar.cfamily.build-wrapper-output.bypass=true

2nd line is a comment and you can skip it also.

Upvotes: 1

Related Questions