Skip to content

Commit 3c6be46

Browse files
committed
Optimized build script with build-for-testing
Also removed double build (for data extraction, and then for testing)
1 parent ce334b7 commit 3c6be46

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

sonar-swift-plugin/src/main/shell/run-sonar-swift.sh

100644100755
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ fi
279279
rm -rf sonar-reports
280280
mkdir sonar-reports
281281

282-
# Extracting project information needed later
283-
buildCmd=($XCODEBUILD_CMD clean build)
284-
echo -n 'Extracting Xcode project information'
282+
# Build and extract project information needed later
283+
buildCmd=($XCODEBUILD_CMD clean build-for-testing)
284+
echo -n 'Building & extracting Xcode project information'
285285
if [[ "$workspaceFile" != "" ]] ; then
286286
buildCmd+=(-workspace "$workspaceFile")
287287
else
@@ -300,20 +300,19 @@ hasObjC="no"
300300
compileCmdFile=compile_commands.json
301301
minimumSize=3
302302
actualSize=$(stat -f%z "$compileCmdFile")
303-
echo "actual = $actualSize, min = $minimumSize"
304303
if [ $actualSize -ge $minimumSize ]; then
305304
hasObjC="yes"
306305
fi
307306

308-
# Unit surefire and coverage
307+
# Tests : surefire and coverage
309308
if [ "$unittests" = "on" ]; then
310309

311310
# Put default xml files with no surefire and no coverage...
312311
echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><testsuites name='AllTestUnits'></testsuites>" > sonar-reports/TEST-report.xml
313312
echo "<?xml version='1.0' ?><!DOCTYPE coverage SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'><coverage><sources></sources><packages></packages></coverage>" > sonar-reports/coverage-swift.xml
314313

315-
echo -n 'Running surefire'
316-
buildCmd=($XCODEBUILD_CMD clean build test)
314+
echo -n 'Running tests'
315+
buildCmd=($XCODEBUILD_CMD test)
317316
if [[ ! -z "$workspaceFile" ]]; then
318317
buildCmd+=(-workspace "$workspaceFile")
319318
elif [[ ! -z "$projectFile" ]]; then

0 commit comments

Comments
 (0)