Build wrapper dump json file is found empty

I am trying my ios build with build wrapper for objective C but getting an error :
java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found empty. Please make sure that:

3327 * you are using the latest version of the build-wrapper and the SonarCFamily analyzer

3328 * your compiler is supported

3329 * you are wrapping your build correctly

3330 * you are wrapping a full/clean build

Can you guide me what I am doing wrong here ? This objective C code analysis on sonar has already taken so much of our time. Really appreciate your help.

Version of the scanner is 4.0… and build wrapper is directly taken from the sonar cloud. So ideally , there should not be any problem.
Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi @Play9win,

sorry to hear that, unfortunately, the same way as this other post of yours (java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /Users/travis/build/[secure]/.../bw_output/build-wrapper-dump.json), if you don’t provide any detail it is not easy to help you.

Please check this post ERROR: Error during SonarQube Scanner execution (java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found but 0 C/C++/Objective-C files were analyzed.), it seems like that you are not correctly setting up the wrapping of your build.

Thanks for replying and sorry about that.

I am building on travis Ci and this is the script I am using for build wrapper:

mkdir /scanner

mkdir /bw

sudo wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.0.0.1744-macosx.zip

sudo unzip sonar-scanner-cli-4.0.0.1744-macosx.zip -d /scanner

sudo wget https://sonarcloud.io/static/cpp/build-wrapper-macosx-x86.zip

sudo unzip build-wrapper-macosx-x86.zip -d /bw

/bw/build-wrapper-macosx-x86/build-wrapper-macosx-x86 --out-dir bw_output xcodebuild build

Please revert asap. Will be really grateful.

Do you have any sort of build cache? Could you run xcodebuild clean build instead? Are you sure at least an Objective-C file gets compiled?

Revert what sorry?

A post was split to a new topic: Empty build-wrapper-dump.json on Azure DevOps

Ran xcodebuild clean build. Still getting the same error. Json file is empty.

Please be informed that this is also what I am getting :

Hi @Play9win,

In your screenshot I can see:

xcodebuild: error: The directory ... does not contain an Xcode project

You should looking at having a successful xcode build.

Done that the build is now failing because of :

error: No profile for team ‘’ matching ‘AppStore’ found: Xcode couldn’t find any provisioning profiles matching '*/AppStore’. Install the profile (by dragging and dropping it onto Xcode’s dock item) or select a different one in the General tab of the target editor. (in target ‘*****’)

Hi @Play9win,

I am not here to fix your xcodebuild issues, you should first focus to get a successful xcodebuild for your project before even trying to analyze it.

Sorry about that. Actually I am using travis CI for build and it executes the build automatically, I just have to mention the dependencies but doing that the error throws :
build-wrapper-dump.json file was found to be empty.

I don’t know why is that happening and how to stop it. I cannot use an explicit build command because whenever I use I get the above error.

Hi @Play9win,

could you please share the .travis.yml file you were using before setting up the analysis? The one which works.

Thank you for your response. Actually nothing works for objective C project since we moved to sonarcloud. Here is the travis yml :

language: objective-c

osx_image: xcode10.1

sudo: false 

addons:

  sonarcloud:

    organization: "............."

cache: 

- cocoapods

- bundler

before_install:

- pod repo update

- pod install --project-directory=./ooid-ios/ooid/

- chmod +x ./scripts/travis/testflight.sh

- chmod +x ./scripts/travis/build.sh

notifications:

  email:

    recipients:

    - amit.yadav@sourcefuse.com

    on_success: always

    on_failure: always

script:

- export SONAR_HOST_URL="[https://sonarcloud.io](https://sonarcloud.io)"

- export SONAR_TOKEN=$SONAR_TRAVIS_TOKEN

- "./scripts/travis/build.sh"

after_success:

- bash ./scripts/travis/testflight.sh

env:

  global:

  - PRODUCTION_RELEASES_BRANCH_NAME=mastersf

  - DEV_BRANCH=dev

  - GIT_RELEASES_BRANCH_NAME=qa

  - BRANCH=$TRAVIS_BRANCH

  - JOB_URL=$TRAVIS_JOB_WEB_URL

  - GIT_REPOSITORY_NAME="..................."

  - secure: .................................................................

  - secure: .................................................................

  - secure: .................................................................

  - secure: ;.................................................................

The build.sh script contains the sonar scanner command with all its properties.

Hi @Play9win,

and this script content?

The script contains the sonar-scanner command:

if [[ "$TRAVIS_PULL_REQUEST" != "false" && "$TRAVIS_BRANCH" = "${DEV_BRANCH}" ]]; then

  sonar-scanner -D sonar.github.pullRequest="$TRAVIS_PULL_REQUEST" \

  #-D sonar.github.login="$GITHUB_USER_NAME" \

  -D sonar.github.repository="$GIT_REPOSITORY_NAME" \

  -D sonar.github.oauth="$GITHUB_ACCESS_TOKEN" \

  -D sonar.host.url="$SONAR_HOST_URL" \

  -D sonar.login="$SONAR_TOKEN" \

  -D sonar.organization="........." -X

else

  if [[ "$TRAVIS_BRANCH" = "${PRODUCTION_RELEASES_BRANCH_NAME}" || "$TRAVIS_BRANCH" = "${DEV_BRANCH}"  ]]; then

    sonar-scanner  -D sonar.host.url=$SONAR_HOST_URL -D sonar.login=$SONAR_TOKEN -D \

-D sonar.organization="........." -X

  fi

fi

Hi @Play9win,

I don’t see any xcodebuild call neither any sonar.cfamily.build-wrapper-output. It is extremely difficult to follow and try to help you as you have troubles building your project.

A post was split to a new topic: Empty build-wrapper-dump.json file