Hi…
I am setting up a SonarCloud scan for my ObjectiveC project in Azure DevOps.
I set up a SonarCloud account ad added the required steps into my build process in Azure DevOps using CLI scanner but I always get an error in my SonarCloudAnalyze task.
The project I am trying to set up has a base iOS target 12.4 and is a clean Objective C project. ( No complex code, No Pods, and only Objective C code )
The error I am getting in the SonarQube analyze task is:
##[error]ERROR: Error during SonarQube Scanner execution
ERROR: Error during SonarQube Scanner execution
##[error]java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /Users/runner/runners/2.158.0/work/1/s/build_wrapper_output/build-wrapper-dump.json
According to the documentation, you have to set the sonar.cfamily.build-wrapper-output property to be able to scan Objective-C code.
If I create the folder before analyzing, I get another error.
##[error]ERROR: Error during SonarQube Scanner execution
ERROR: Error during SonarQube Scanner execution
##[error]java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /Users/runner/runners/2.158.0/work/1/s/build_wrapper_output/build-wrapper-dump.json
And if I go and create the folder and file I get this error here:
##[error]ERROR: Error during SonarQube Scanner execution
ERROR: Error during SonarQube Scanner execution
##[error]java.lang.IllegalStateException: java.io.EOFException: End of input at line 1 column 1
java.lang.IllegalStateException: java.io.EOFException: End of input at line 1 column 1
##[error]at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:311)
##[error]at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:206)
The original error suggests that I should add the following lines to my config but the whole idea is to scan my objective c code.
sonar.c.file.suffixes=-
sonar.cpp.file.suffixes=-
sonar.objc.file.suffixes=-
I ran into some posts in where a suggested fix for this would be to call a specific build-wrapper instead of https://sonarcloud.io but I have not found a good way to do that within Azure DevOps. (Issue with build-wrapper-output)
vmImage:
I am running a macOS-10.14 image in Azure Devops.
Azure devops SonarCube log info:
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 4.1.0.1829
INFO: Java 1.8.0_222 Azul Systems, Inc. (64-bit)
INFO: Mac OS X 10.14.6 x86_64
INFO: User cache: /Users/runner/.sonar/cache
INFO: SonarQube server 8.0.0
My prepare task in the Azure DevOps build process:
task: SonarCloudPrepare@1
inputs:
SonarCloud: 'https://sonarcloud.io'
organization: 'myorg'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'AzIT.ObjcDemo'
cliProjectName: 'AzIT.ObjcDemo'
cliSources: '.'
extraProperties: |
sonar.cfamily.build-wrapper-output=build_wrapper_output
Is there anything i’m missing in config or is this a known issue in the latest macOS image in Azure DevOps ?