How to use build-wrapper in BuddyBuild

  • ALM used: GitHub
  • CI system used: BuddyBuild
  • Scanner command used: through fastlane plugin with parameters, tried various, this is one of it
    fastlane sonarqube project_configuration_path:".sonarcloud.properties" sonar_organization:<redacted> project_key:<redacted> project_version:<redacted> sonar_url:https://sonarcloud.io sonar_login:<SONAR_TOKEN redacted> sonar_runner_args:-Dsonar.verbose=true -Dsonar.scm.revision=refs/pull/2961/head pull_request_base:"develop" pull_request_branch:"<branch radacted>"

.sonarcloud.properties

    sonar.projectKey=<radacted>
    sonar.projectName=<radacted>
    sonar.projectDescription=<radacted>
    sonar.sources=<relative paths from repo directory>
    sonar.exclusions=<exclusions>

    sonar.tests=<relative paths from repo directory for unit tests>
    sonar.swift.simulator=platform=iOS Simulator,name=iPhone X,OS=12.4
    sonar.swift.coverage.reportPattern=sonar-reports/cobertura.xml
    sonar.swift.project=<path>/<project name radacted>.xcodeproj
    sonar.swift.workspace=<path>/<project name radacted>.xcworkspace

    sonar.swift.appName=<radacted>
    sonar.swift.appScheme=<radacted>
    sonar.swift.appConfiguration=Debug
    sonar.sourceEncoding=UTF-8

    sonar.swift.tailor.report=<path>/sonar-reports/*tailor.txt
    sonar.swift.tailor.config=--no-color --max-line-length=100 --max-file-length=500 --max-name-length=40 --max-name-length=40 --min-name-length=4
  • Languages of the repository: Swift + Objective C
  • Only if the SonarCloud project is public, the URL: (private)
  • Error observed: If not disabling Objective C and trying to explicitly bypass build-wrapper, can see error log message
2020-06-13T00:46:06.811Z - ce:     INFO: CFamily plugin version: 6.10.0.18490

2020-06-13T00:46:06.812Z - ce:     ERROR: 

2020-06-13T00:46:06.814Z - ce:     The only way to get an accurate analysis of C/C++/Objective-C files is by using the SonarSource build-wrapper

2020-06-13T00:46:06.816Z - ce:     and setting the property "sonar.cfamily.build-wrapper-output", but it was not specified.

2020-06-13T00:46:06.817Z - ce:     If you don't want to analyze C/C++/Objective-C files, then prevent them from being analyzed by setting the following properties:

2020-06-13T00:46:06.818Z - ce:         sonar.c.file.suffixes=-

2020-06-13T00:46:06.819Z - ce:         sonar.cpp.file.suffixes=-

2020-06-13T00:46:06.820Z - ce:         sonar.objc.file.suffixes=-

It appears the build-wrapper requirement for Objective C was newly introduced in 2020.

  • Steps to reproduce: Trigger buddybuild job
  • Potential workaround:
    • May try to explicitly run xcodebuild again in the BuddyBuild post-build with build-wrapper. However, this doubles the build time. And it is very significant for a large project build.

Could anyone advise the best way to enable Objective C analysis in BuddyBuild environment?

Hello @awpa,

Build-wrapper was always a requirement for analyzing obj-c code. Maybe before it was implicitly not analyzing your obj-c files. To perfom the analysis you need to run build-wrapper first. Please follow the detailed documentation here.

Thanks,

1 Like

Hi, @Abbas_Sabra, thanks for your response. With another discussion, I assume the requirement was earlier, just that I could run fine with a recent SonarQube version 8.2, that gave me an impression that it was working.

Since BuddyBuild starts the xcodebuild by itself without a possibility to add build-wrapper, apart from running xcodebuild the second time with build-wrapper that doubles the build time, could you recommend a better way to achieve this for Objective C sonar analysis on BuddyBuild?

@awpa, you don’t have to wrap xcodebuild command directly. You can try to wrap one of the commands that are leading to xcodebuild execution. I’m not sure if this applies to BuddyBuild since I’m not familiar with the tool.

@Abbas_Sabra, for BuddyBuild, we have no control to trigger the build being a part of the built-in CI process. If what you refer to is like having fastlane to start the xcodebuild and the build-wrapper can wrap fastlane, then it is not available in BuddyBuild. Please correct me if I misunderstand your meaning. Otherwise, would it mean the only way is to run xcodebuild the second time with the build-wrapper?

@awpa, In that case, you are right you have to build a second time with build-wrapper. I don’t see a workaround in your case since you have no control over your build command.