File tree 2 files changed +8
-8
lines changed
2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ lane :sonarqube do |options|
132
132
sq_coverage_report = "#{ TEST_OUTPUT } /sonarqube-coverage.xml"
133
133
Dir . chdir ( ".." ) do
134
134
sh "rm #{ sq_coverage_report } "
135
- xccov_reports = Dir [ "#{ DERIVED_DATA_PATH } /Logs/Test/**/*.xccovarchive " ] . join ( " " )
136
- sh "scripts/xccov-to-sonarqube.sh #{ xccov_reports } > #{ sq_coverage_report } "
135
+ cov_reports = Dir [ "#{ DERIVED_DATA_PATH } /Logs/Test/**/*.xcresult " ] . join ( " " )
136
+ sh "scripts/xccov-to-sonarqube.sh #{ cov_reports } > #{ sq_coverage_report } "
137
137
end
138
138
139
139
# Run Sonarqube analysis
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
set -euo pipefail
3
3
4
- # See
4
+ # Adapted from
5
5
# https://docs.sonarqube.org/display/PLUG/Swift+Coverage+Results+Import
6
6
# https://github.com/SonarSource/sonar-scanning-examples/blob/master/swift-coverage/swift-coverage-example/xccov-to-sonarqube-generic.sh
7
7
8
8
function convert_file {
9
- local xccovarchive_file =" $1 "
9
+ local xcresult_bundle =" $1 "
10
10
local file_name=" $2 "
11
11
echo " <file path=\" $file_name \" >"
12
- xcrun xccov view --file " $file_name " " $xccovarchive_file " | \
12
+ xcrun xccov view --archive -- file " $file_name " " $xcresult_bundle " | \
13
13
sed -n '
14
14
s/^ *\([0-9][0-9]*\): 0.*$/ <lineToCover lineNumber="\1" covered="false"\/>/p;
15
15
s/^ *\([0-9][0-9]*\): [1-9].*$/ <lineToCover lineNumber="\1" covered="true"\/>/p
@@ -19,9 +19,9 @@ function convert_file {
19
19
20
20
function xccov_to_generic {
21
21
echo ' <coverage version="1">'
22
- for xccovarchive_file in " $@ " ; do
23
- xcrun xccov view --file-list " $xccovarchive_file " | while read -r file_name; do
24
- convert_file " $xccovarchive_file " " $file_name "
22
+ for xcresult_bundle in " $@ " ; do
23
+ xcrun xccov view --archive -- file-list " $xcresult_bundle " | while read -r file_name; do
24
+ convert_file " $xcresult_bundle " " $file_name "
25
25
done
26
26
done
27
27
echo ' </coverage>'
You can’t perform that action at this time.
0 commit comments