Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Fix coverage with mixed objc swift project #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sample/sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ sonar.sourceEncoding=UTF-8
# The XML files have to be prefixed by TEST- otherwise they are not processed
# sonar.junit.reportsPath=sonar-reports/

# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage-objc.xml
# Change it only if you generate the file on your own
# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml
# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage-objc*.xml

# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
# Change it only if you generate the file on your own
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class CoberturaSensor implements Sensor {

public static final String REPORT_PATTERN_KEY = ObjectiveCPlugin.PROPERTY_PREFIX
+ ".coverage.reportPattern";
public static final String DEFAULT_REPORT_PATTERN = "sonar-reports/coverage*.xml";
public static final String DEFAULT_REPORT_PATTERN = "sonar-reports/coverage-objc*.xml";

private final ReportFilesFinder reportFilesFinder;

Expand Down
6 changes: 3 additions & 3 deletions src/main/shell/run-sonar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ if [ "$testScheme" = "" ] || [ "$unittests" = "" ]; then

# Put default xml files with no tests and no coverage...
echo "<?xml version='1.0' encoding='UTF-8' standalone='yes'?><testsuites name='AllTestUnits'></testsuites>" > sonar-reports/TEST-report.xml
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.xml
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-objc.xml
else

echo -n 'Running tests'
Expand Down Expand Up @@ -308,7 +308,7 @@ else
slatherCmd+=( --scheme "$appScheme" $firstProject)

runCommand /dev/stdout "${slatherCmd[@]}"
mv sonar-reports/cobertura.xml sonar-reports/coverage.xml
mv sonar-reports/cobertura.xml sonar-reports/coverage-objc.xml

else

Expand All @@ -334,7 +334,7 @@ else
ln -s $coverageFilesPath sonar-reports/build

# Run gcovr with the right options
runCommand "sonar-reports/coverage.xml" gcovr -r . $excludedCommandLineFlags --xml
runCommand "sonar-reports/coverage-objc.xml" gcovr -r . $excludedCommandLineFlags --xml

fi

Expand Down