The "build-wrapper-dump.json" file was found empty. SonarCloud scanner for Objective-c repo

Here is my sonar-project.property file:

sonar.projectKey=sfara_ios-sdk-platform-sonarcloud
sonar.organization=sfara
sonar.cfamily.build-wrapper-output=.

# This is the name and version displayed in the SonarCloud UI.
sonar.projectName=ios-sdk-platform-sonarcloud
sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
sonar.sources=.

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

I am trying to integrate the sonarcloud and github action for objective-c repo. But I keep getting this error:

java.lang.IllegalStateException: The "build-wrapper-dump.json" file was found empty. Please make sure that:

This is the build command line I am using for building wrapper:
build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild clean build -workspace Sfara-Platform-SDK-iOS/SfaraSDK.xcworkspace -scheme SfaraSDK-iOS -configuration Release -arch arm64 BITCODE_GENERATION_MODE=bitcode ONLY_ACTIVE_ARCH=NO -sdk iphoneos BUILD_LIBRARIES_FOR_DISTRIBUTION=YES

and here is the build wrapper out dir: BUILD_WRAPPER_OUT_DIR: ../Sfara-Platform-SDK-iOS
Please help me. I have tried everything but nothing is working.

Thanks

Can you upload your build-wrapper.log file that should be in the build wrapper output directory?

I misconfigured build wrapper output directory and I am trying to change it it throws an error and I cannot find build-wrapper.log file. How can i clean the cash or reset all building and start over again?

And I am running this in GitHub actions. So is it saving the logs in GitHub?

Please help. I need to solve this problem today. You can DM me also if you want or can. I never used SonarCloud before I am kinda lost. Thanks

It’s probably a good idea to try and run this locally to see if you face the problem there – and so that you can more easily access the logs.

It’s a Friday evening, so see you next week!

Hi Colin,
Thanks for responding. I have solved the problem I posted but know i see this:
A few extra steps are needed for SonarCloud to analyze your code coverage Setup coverage analysis

I don’t see any code that analyzed. Actually I would see the code analyzed if i change some files. But i want to analyze the whole repo once and then analyze the code that have been changed. Is it possible?

This is my build.yml file

name: Build
on:
  push:
    branches:
      - develop
      - branch-*
  pull_request:
    types: [opened, synchronize, reopened]
    branches:
      - develop
      - branch-*
jobs:
  build:
    name: Build
    runs-on: macos-latest
    env:
      SONAR_SCANNER_VERSION: 4.7.0.2747
      SONAR_SERVER_URL: "https://sonarcloud.io"
      BUILD_WRAPPER_OUT_DIR: . # Directory where build-wrapper output will be placed
      SSH_KEY: ~/.ssh/id_ed25519
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0  #Shallow clones should be disabled for a better relevancy of analysis
      - name: Set up JDK 11
        uses: actions/setup-java@v1
        with:
          java-version: 11
      - name: Set up Ruby 2.6
        uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6
        with:
          ruby-version: 2.6
      - uses: webfactory/ssh-agent@v0.5.4
        with:
          ssh-private-key: ${{ secrets.SSH_KEY }}
      - name: Bundle Install
        working-directory: Sfara-Platform-SDK-iOS
        run: |
          bundle install
          bundle exec pod keys set "PlatformSecret" "anykey" SfaraSDK
      - name: CocoaPod Install
        working-directory: Sfara-Platform-SDK-iOS
        run: |
          gem install cocoapods
          gem install cocoapods-acknowledgements
          gem install --user-install cocoapods-keys
          pod install
      - name: Download and set up sonar-scanner
        env:
          SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-macosx.zip
        run: |
          mkdir -p $HOME/.sonar
          curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
          unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
          echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-macosx/bin" >> $GITHUB_PATH
      - name: Cache SonarCloud packages
        uses: actions/cache@v1
        with:
          path: ~/.sonar/cache
          key: ${{ runner.os }}-sonar
          restore-keys: ${{ runner.os }}-sonar
      - name: Download and set up build-wrapper
        env:
          BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-macosx-x86.zip
        run: |
          curl -sSLo $HOME/.sonar/build-wrapper-macosx-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
          unzip -o $HOME/.sonar/build-wrapper-macosx-x86.zip -d $HOME/.sonar/
          echo "$HOME/.sonar/build-wrapper-macosx-x86" >> $GITHUB_PATH
      - name: Run build-wrapper
        run: |
          build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} xcodebuild clean build -workspace Sfara-Platform-SDK-iOS/SfaraSDK.xcworkspace -scheme SfaraSDK-iOS -configuration Release -arch arm64 BITCODE_GENERATION_MODE=bitcode ONLY_ACTIVE_ARCH=NO -sdk iphoneos BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
      - name: Run sonar-scanner
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
        run: |
          sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"

You can close this one because i opened new issue for 0 analyzed code.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.