Skip to content

Commit 6c445c0

Browse files
vvalderrvlgritz
authored andcommitted
fix: Switch to compile-commands (#4879)
Fix SonarCloud analysis failures by switching the C/C++ configuration from the deprecated `sonar.cfamily.build-wrapper-output` property to the current `sonar.cfamily.compile-commands` property. **Changes** - Remove `sonar.cfamily.build-wrapper-output` from `sonar-project.properties`. - In `.github/workflows/build-steps.yml`, pass `--define sonar.cfamily.compile-commands="$BUILD_WRAPPER_OUT_DIR/compile_commands.json"`. **Root cause** The SonarCloud config still used the deprecated `sonar.cfamily.build-wrapper-output` property. The current CFamily analyzer expects a `compile_commands.json` (produced by build-wrapper). Using the old property caused scanner failures and blocked analysis. **Validation** Regenerated `bw_output/compile_commands.json`, ran `sonar-scanner`, and confirmed the scan completed and uploaded successfully. **Tests** CI-only change. Verified locally by running the scanner against a fresh build-wrapper capture. --------- Signed-off-by: Vanessa Valderrama <[email protected]>
1 parent 38a4f94 commit 6c445c0

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

.github/workflows/build-steps.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ jobs:
186186
ls -l /__w/OpenImageIO/OpenImageIO/bw_output
187187
echo "BUILD_OUTPUT_DIR is " "${{ env.BUILD_WRAPPER_OUT_DIR }}"
188188
find . -name "*.gcov" -print
189-
# sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
190-
time sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="$BUILD_WRAPPER_OUT_DIR" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
189+
# sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json"
190+
time sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.compile-commands="$BUILD_WRAPPER_OUT_DIR/compile_commands.json" --define sonar.cfamily.gcov.reportsPath="_coverage" --define sonar.cfamily.threads="$PARALLEL"
191191
# Consult https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarscanner-cli/ for more information and options
192192
- name: Check ABI
193193
if: inputs.abi_check != ''

sonar-project.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ sonar.exclusions=src/doc/**,src/include/OpenImageIO/detail/pugixml/**,src/libuti
2121
sonar.sourceEncoding=UTF-8
2222

2323
# C/C++ analyzer properties
24-
sonar.cfamily.build-wrapper-output=/__w/OpenImageIO/OpenImageIO/bw_output
2524
sonar.cfamily.gcov.reportsPath=_coverage
2625
sonar.coverage.exclusions=src/iv/**,src/include/OpenImageIO/detail/pugixml/**,src/include/OpenImageIO/detail/fmt/**,src/libOpenImageIO/kissfft.hh
2726

0 commit comments

Comments
 (0)