Whether to execute build-wrapper along with build or unit test for Object C projects

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Enterprise Edition Version 7.9.1 (build 27448);
    SonarQube Scanner 4.2.0.1873-macosx;
    SonarQube build-wrapper-macosx-x86 6.3
  • what are you trying to achieve
    Whether should I execute build-wrapper along with Build or Unit Test for OC projects
  • what have you tried so far to achieve this
    I tried to execute build-wrapper in two scenarios: execute it along with Build(command like: “build-wrapper-macosx-x86 --out-dir build_wrapper_out xcodebuild clean build -scheme <scheme_name>”) and execute it along with Unit Test(command like: "build-wrapper-macosx-x86 --out-dir build_wrapper_out xcodebuild clean build test -scheme <scheme_name>"), then execute sonar scanner with their outputs of build_wrapper, I got different final reports in these two scenarios and the count of issues in UnitTest is larger than that in Build, which seems to mean build-wrapper works better with UnitTest than Build.
    I don’t find any guide about this problem in the official release document but only an example: “build-wrapper-macosx-x86 --out-dir build_wrapper_output_directory xcodebuild clean build”, does it mean I should execute build-wrapper along with Build rather than Unit Test?

Hello @taoy,

What is analyzed by the scanner is the file built in the command you pass to the build-wrapper.
so if “build-wrapper-macosx-x86 --out-dir build_wrapper_out xcodebuild clean build test -scheme <scheme_name>” build more files the scanner will analyze more files.

In the end, what you want to pass the build-wrapper is a command that cleanly builds all the files that you want to analyze. The documentation just provides a simple example, you are allowed to customize it in the way that you wants as long as you pass a valid command that cleanly builds the file you want to analyze.

Let me know if you have further questions