|
153 | 153 | workspaceFile=''; readParameter workspaceFile 'sonar.objectivec.workspace'
|
154 | 154 | projectFile=''; readParameter projectFile 'sonar.objectivec.project'
|
155 | 155 | if [[ "$workspaceFile" != "" ]] ; then
|
156 |
| - xctoolCmdPrefix="xctool -workspace $workspaceFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO OBJROOT=./build" |
| 156 | + xctoolCmdPrefix="xctool -workspace $workspaceFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO" |
157 | 157 | else
|
158 |
| - xctoolCmdPrefix="xctool -project $projectFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO OBJROOT=./build" |
| 158 | + xctoolCmdPrefix="xctool -project $projectFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO" |
159 | 159 | fi
|
160 | 160 |
|
161 | 161 | # Source directories for .h/.m files
|
@@ -231,10 +231,7 @@ if [ "$testScheme" = "" ]; then
|
231 | 231 | else
|
232 | 232 |
|
233 | 233 | echo -n 'Running tests using xctool'
|
234 |
| - # Not using runCommand function because xctool may return 1, even if everything is fine (maybe a xctool bug ?) |
235 |
| - #runCommand /dev/null $xctoolCmdPrefix -scheme "$testScheme" GCC_PRECOMPILE_PREFIX_HEADER=NO GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES -reporter junit:sonar-reports/TEST-report.xml -reporter plain clean test |
236 |
| - $xctoolCmdPrefix -scheme "$testScheme" GCC_PRECOMPILE_PREFIX_HEADER=NO GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES -reporter junit:sonar-reports/TEST-report.xml -reporter plain clean test |
237 |
| - |
| 234 | + runCommand sonar-reports/TEST-report.xml $xctoolCmdPrefix -scheme "$testScheme" -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test |
238 | 235 |
|
239 | 236 | echo -n 'Computing coverage report'
|
240 | 237 |
|
|
243 | 240 | # Extract the path to the .gcno/.gcda coverage files
|
244 | 241 | echo $projectFile | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh
|
245 | 242 | while read projectName; do
|
246 |
| - |
247 |
| - projectName=$(basename $projectFile .xcodeproj) |
248 |
| - coverageFilesPath="build/$projectName.build/Debug-iphonesimulator/$appScheme.build/Objects-normal/i386" |
| 243 | + |
| 244 | + coverageFilesPath=$(grep 'command' compile_commands.json | sed 's#^.*-o \\/#\/#;s#",##' | grep "${projectName%%.*}.build" | awk 'NR<2' | sed 's/\\\//\//g' | sed 's/\\\\//g' | xargs -0 dirname) |
249 | 245 | if [ "$vflag" = "on" ]; then
|
250 | 246 | echo
|
251 | 247 | echo "Path for .gcno/.gcda coverage files is: $coverageFilesPath"
|
|
265 | 261 | fi
|
266 | 262 |
|
267 | 263 | # Run gcovr with the right options
|
268 |
| - runCommand "sonar-reports/coverage-${projectName%%.*}.xml" gcovr -r . --object-directory "$coverageFilesPath" $excludedCommandLineFlags --xml |
| 264 | + runCommand "sonar-reports/coverage-${projectName%%.*}.xml" gcovr -r . "$coverageFilesPath" $excludedCommandLineFlags --xml |
269 | 265 |
|
270 | 266 | done < tmpFileRunSonarSh
|
271 | 267 | rm -rf tmpFileRunSonarSh
|
|
0 commit comments