Skip to content

Commit 2ed7b3f

Browse files
committed
Revert modifications on run-sonar.sh done for 5.x support
1 parent 66ff3a1 commit 2ed7b3f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/main/shell/run-sonar.sh

+6-10
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ fi
153153
workspaceFile=''; readParameter workspaceFile 'sonar.objectivec.workspace'
154154
projectFile=''; readParameter projectFile 'sonar.objectivec.project'
155155
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"
157157
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"
159159
fi
160160

161161
# Source directories for .h/.m files
@@ -231,10 +231,7 @@ if [ "$testScheme" = "" ]; then
231231
else
232232

233233
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
238235

239236
echo -n 'Computing coverage report'
240237

@@ -243,9 +240,8 @@ else
243240
# Extract the path to the .gcno/.gcda coverage files
244241
echo $projectFile | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh
245242
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)
249245
if [ "$vflag" = "on" ]; then
250246
echo
251247
echo "Path for .gcno/.gcda coverage files is: $coverageFilesPath"
@@ -265,7 +261,7 @@ else
265261
fi
266262

267263
# 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
269265

270266
done < tmpFileRunSonarSh
271267
rm -rf tmpFileRunSonarSh

0 commit comments

Comments
 (0)