diff --git a/README.adoc b/README.adoc index 124431e..5a383f6 100644 --- a/README.adoc +++ b/README.adoc @@ -12,14 +12,21 @@ It is very easy to manually analyze a C, C++ and Objective-C project with SonarQ . Download and unzip the https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/[SonarScanner] for macOS . Add the bin directory of the SonarScanner to your `$PATH` . Wrap your clean build command with the Build Wrapper. E.g.: `build-wrapper-macosx-x86 --out-dir bw-output xcodebuild clean build` -. Run `sonar-scanner` specifying `-Dsonar.cfamily.build-wrapper-output=bw-output` (with `bw-output` being the same directory as the one passed to Build Wrapper as `--out-dir`) +. Run `sonar-scanner` specifying: ++ +-- +.. `-Dsonar.cfamily.compile-commands=bw-output/compile_commands.json` if you are using SonarQube version 10.6 or later +.. `-Dsonar.cfamily.build-wrapper-output=bw-output` if you are using SonarQube version 10.5 or earlier, as build-wrapper did not generate a `compile_commands.json` file before SonarQube 10.6 +-- ++ +Noting that `bw-output` is the directory passed to build wrapper as `--out-dir` You can take a look at the link:sonar-project.properties[sonar-project.properties] and link:build-analyze.sh[build-analyze.sh] (a script that downloads the `sonar-scanner` and the Build Wrapper before compiling and analyzing the project) to see it in practice. Please be aware that the SonarQube server URLs and the `sonar.login` are not completed in these examples. = Documentation - https://docs.sonarqube.org/latest/analysis/languages/cfamily/[Documentation of the C, C++ and Objective-C plugin and its Build Wrapper] -- https://docs.sonarqube.org/latest/analyzing-source-code/languages/c-family/#analysis-cache[Configuring C, C++ and Objective-C analysis cache] -- https://docs.sonarqube.org/latest/analyzing-source-code/languages/c-family/#parallel-code-scan[Configuring multithreaded execution] +- https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/c-family/customizing-the-analysis/#analysis-cache[Configuring C, C++ and Objective-C analysis cache] +- https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/c-family/customizing-the-analysis/#parallel-code-scan[Configuring multithreaded execution] = macOS\XCodeBuild diff --git a/build-analyze.sh b/build-analyze.sh index 0a7e4d0..1bdef0a 100755 --- a/build-analyze.sh +++ b/build-analyze.sh @@ -29,4 +29,6 @@ xcodebuild -project macos-xcode.xcodeproj clean build-wrapper-macosx-x86 --out-dir $BUILD_WRAPPER_OUT_DIR xcodebuild -project macos-xcode.xcodeproj -configuration Release # Run sonar scanner -sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.login=$SONAR_TOKEN -Dsonar.cfamily.build-wrapper-output=$BUILD_WRAPPER_OUT_DIR +sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.login=$SONAR_TOKEN -Dsonar.cfamily.compile-commands=$BUILD_WRAPPER_OUT_DIR/compile_commands.json +# if you are using using SonarQube 10.5 or earlier, replace -Dsonar.cfamily.compile-commands with -Dsonar.cfamily.build-wrapper-output=$BUILD_WRAPPER_OUT_DIR +# as build-wrapper does not generate a compile_commands.json file before SonarQube 10.6