xcov 1.7.0 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xcov-core/bin/xcov-core +0 -0
- data/lib/xcov/manager.rb +59 -17
- data/lib/xcov/model/source.rb +9 -2
- data/lib/xcov/model/target.rb +5 -4
- data/lib/xcov/options.rb +8 -0
- data/lib/xcov/version.rb +1 -1
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad78b9f52d699c7e6bf5dcc683bc4667554fc69195715a82421e94857c8d423b
|
4
|
+
data.tar.gz: d7bd573a388548e5c4a5db7dae2ccadb15f2af07f8320d1306501bee2060075e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b85d2d86d36d973ea3c5c1955d65f52f49025e69ad3fa9f9cdd9ad04f448a7fbd51fab37be40d1d80c8ec11a08dede70e9283b3807917d8f2551685463173c0
|
7
|
+
data.tar.gz: 7a7cbc59f9f5294e1ecdf0e897b42dc8cadcf21766c117f0b0063a6a7bcbc6e2eaa3c160c8007510bb69fd8193add232adbbf62c9fe22d5eb41e31839297c694
|
data/lib/xcov-core/bin/xcov-core
CHANGED
Binary file
|
data/lib/xcov/manager.rb
CHANGED
@@ -35,6 +35,8 @@ module Xcov
|
|
35
35
|
submit_to_coveralls(report)
|
36
36
|
tmp_dir = File.join(Xcov.config[:output_directory], 'tmp')
|
37
37
|
FileUtils.rm_rf(tmp_dir) if File.directory?(tmp_dir)
|
38
|
+
|
39
|
+
json_report
|
38
40
|
end
|
39
41
|
|
40
42
|
def parse_xccoverage
|
@@ -47,11 +49,13 @@ module Xcov
|
|
47
49
|
# If no xccov direct path, use the old derived data path method
|
48
50
|
if xccov_file_direct_paths.nil?
|
49
51
|
extension = Xcov.config[:legacy_support] ? "xccoverage" : "xccovreport"
|
52
|
+
|
50
53
|
test_logs_path = derived_data_path + "Logs/Test/"
|
51
|
-
|
52
|
-
|
54
|
+
UI.important("Derived content from #{Dir["#{test_logs_path}/*"]}")
|
55
|
+
|
56
|
+
xccoverage_files = Dir["#{test_logs_path}*.#{extension}", "#{test_logs_path}*.xcresult/*/action.#{extension}"]
|
53
57
|
if xccoverage_files.empty?
|
54
|
-
xcresult_paths = Dir["#{test_logs_path}*.xcresult"]
|
58
|
+
xcresult_paths = Dir["#{test_logs_path}*.xcresult"]
|
55
59
|
xcresult_paths.each do |xcresult_path|
|
56
60
|
xcresults_to_parse_and_export << xcresult_path
|
57
61
|
end
|
@@ -75,6 +79,7 @@ module Xcov
|
|
75
79
|
# Iterates over xcresults
|
76
80
|
# Exports .xccovarchives
|
77
81
|
# Exports .xccovreports and collects the paths
|
82
|
+
# Merge .xccovreports if multiple exists and return merged report
|
78
83
|
unless xcresults_to_parse_and_export.empty?
|
79
84
|
xccoverage_files = process_xcresults!(xcresults_to_parse_and_export)
|
80
85
|
end
|
@@ -86,6 +91,7 @@ module Xcov
|
|
86
91
|
|
87
92
|
# Convert .xccoverage file to json
|
88
93
|
ide_foundation_path = Xcov.config[:legacy_support] ? nil : Xcov.config[:ideFoundationPath]
|
94
|
+
xccoverage_files = xccoverage_files.sort_by {|filename| File.mtime(filename)}.reverse
|
89
95
|
json_report = Xcov::Core::Parser.parse(xccoverage_files.first, Xcov.config[:output_directory], ide_foundation_path)
|
90
96
|
ErrorHandler.handle_error("UnableToParseXccoverageFile") if json_report.nil?
|
91
97
|
|
@@ -202,30 +208,66 @@ module Xcov
|
|
202
208
|
def process_xcresults!(xcresult_paths)
|
203
209
|
output_path = Xcov.config[:output_directory]
|
204
210
|
FileUtils.mkdir_p(output_path)
|
205
|
-
|
206
|
-
|
211
|
+
|
212
|
+
result_path = ""
|
213
|
+
index = 0
|
214
|
+
|
215
|
+
xcresult_paths.flat_map do |xcresult_path|
|
207
216
|
begin
|
208
217
|
parser = XCResult::Parser.new(path: xcresult_path)
|
209
|
-
|
218
|
+
|
210
219
|
# Exporting to same directory as xcresult
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
#
|
215
|
-
|
216
|
-
|
220
|
+
tmp_archive_paths = parser.export_xccovarchives(destination: output_path)
|
221
|
+
tmp_report_paths = parser.export_xccovreports(destination: output_path)
|
222
|
+
|
223
|
+
# Rename each file with global index
|
224
|
+
tmp_report_paths.each_with_index do |item, i|
|
225
|
+
File.rename(tmp_archive_paths[i], "#{output_path}/xccovarchive-#{index + i}.xccovarchive")
|
226
|
+
File.rename(item, "#{output_path}/xccovreport-#{index + i}.xccovreport")
|
227
|
+
index += 1
|
217
228
|
end
|
218
|
-
report_paths.each do |path|
|
219
|
-
UI.important("Copying .xccovreport to #{path}")
|
220
|
-
end
|
221
|
-
|
222
|
-
report_paths
|
223
229
|
rescue
|
224
230
|
UI.error("Error occured while exporting xccovreport from xcresult '#{xcresult_path}'")
|
225
231
|
UI.error("Make sure you have both Xcode 11 selected and pointing to the correct xcresult file")
|
226
232
|
UI.crash!("Failed to export xccovreport from xcresult'")
|
227
233
|
end
|
228
234
|
end
|
235
|
+
|
236
|
+
# Grab paths from the directory instead of parser
|
237
|
+
report_paths = Dir["#{output_path}/*.xccovreport"]
|
238
|
+
archive_paths = Dir["#{output_path}/*.xccovarchive"]
|
239
|
+
|
240
|
+
# Merge coverage reports
|
241
|
+
if report_paths.length > 1 then
|
242
|
+
# Creating array of paths for merging
|
243
|
+
paths = ""
|
244
|
+
for i in 0..report_paths.length
|
245
|
+
paths += " #{report_paths[i]} #{archive_paths[i]}"
|
246
|
+
end
|
247
|
+
|
248
|
+
UI.important("Merging multiple coverage reports with #{paths}")
|
249
|
+
if system ( "xcrun xccov merge --outReport #{output_path}/out.xccovreport --outArchive #{output_path}/out.xccovarchive #{paths}" ) then
|
250
|
+
result_path = "#{output_path}/out.xccovreport"
|
251
|
+
else
|
252
|
+
UI.error("Error occured during merging multiple coverage reports")
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
if result_path == "" then
|
257
|
+
# Informating user of export paths
|
258
|
+
archive_paths.each do |path|
|
259
|
+
UI.important("Copying .xccovarchive to #{path}")
|
260
|
+
end
|
261
|
+
report_paths.each do |path|
|
262
|
+
UI.important("Copying .xccovreport to #{path}")
|
263
|
+
end
|
264
|
+
|
265
|
+
# Return array of report_paths if coverage reports were not merged
|
266
|
+
return report_paths
|
267
|
+
else
|
268
|
+
# Return merged xccovreport
|
269
|
+
return [result_path]
|
270
|
+
end
|
229
271
|
end
|
230
272
|
end
|
231
273
|
end
|
data/lib/xcov/model/source.rb
CHANGED
@@ -8,14 +8,18 @@ module Xcov
|
|
8
8
|
attr_accessor :type
|
9
9
|
attr_accessor :ignored
|
10
10
|
attr_accessor :coverage
|
11
|
+
attr_accessor :coveredLines
|
12
|
+
attr_accessor :executableLines
|
11
13
|
attr_accessor :functions
|
12
14
|
attr_accessor :function_templates
|
13
15
|
attr_accessor :lines
|
14
16
|
|
15
|
-
def initialize(name, location, coverage, functions, lines = nil)
|
17
|
+
def initialize(name, location, coverage, coveredLines, executableLines, functions, lines = nil)
|
16
18
|
@name = CGI::escapeHTML(name)
|
17
19
|
@location = CGI::escapeHTML(location)
|
18
20
|
@coverage = coverage
|
21
|
+
@coveredLines = coveredLines
|
22
|
+
@executableLines = executableLines
|
19
23
|
@functions = functions
|
20
24
|
@ignored = Xcov.ignore_handler.should_ignore_file_at_path(location)
|
21
25
|
@displayable_coverage = self.create_displayable_coverage
|
@@ -52,6 +56,7 @@ module Xcov
|
|
52
56
|
def json_value
|
53
57
|
value = {
|
54
58
|
"name" => @name,
|
59
|
+
"path" => @location,
|
55
60
|
"coverage" => @coverage,
|
56
61
|
"type" => @type,
|
57
62
|
"functions" => @functions ? @functions.map{ |function| function.json_value } : []
|
@@ -68,9 +73,11 @@ module Xcov
|
|
68
73
|
name = dictionary["name"]
|
69
74
|
location = dictionary["location"]
|
70
75
|
coverage = dictionary["coverage"]
|
76
|
+
coveredLines = dictionary["coveredLines"]
|
77
|
+
executableLines = dictionary["executableLines"]
|
71
78
|
functions = dictionary["functions"].map { |function| Function.map(function)}
|
72
79
|
lines = map_lines(dictionary["lines"])
|
73
|
-
Source.new(name, location, coverage, functions, lines)
|
80
|
+
Source.new(name, location, coverage, coveredLines, executableLines, functions, lines)
|
74
81
|
end
|
75
82
|
|
76
83
|
def self.map_lines(dictionaries)
|
data/lib/xcov/model/target.rb
CHANGED
@@ -7,10 +7,12 @@ module Xcov
|
|
7
7
|
attr_accessor :files
|
8
8
|
attr_accessor :file_templates
|
9
9
|
|
10
|
-
def initialize(name,
|
10
|
+
def initialize(name, files)
|
11
11
|
@name = CGI::escapeHTML(name)
|
12
12
|
@files = files
|
13
|
-
|
13
|
+
totalCoveredLines = files.reduce(0) { |acc, file| acc + file.coveredLines }
|
14
|
+
totalExecutableLines = files.reduce(0) { |acc, file| acc + file.executableLines }
|
15
|
+
@coverage = files.count == 0 || totalExecutableLines == 0 ? 0.0 : totalCoveredLines.to_f / totalExecutableLines.to_f
|
14
16
|
@displayable_coverage = self.create_displayable_coverage
|
15
17
|
@coverage_color = self.create_coverage_color
|
16
18
|
@id = Target.create_id(name)
|
@@ -53,12 +55,11 @@ module Xcov
|
|
53
55
|
|
54
56
|
def self.map(dictionary)
|
55
57
|
name = dictionary["name"]
|
56
|
-
coverage = dictionary["coverage"]
|
57
58
|
files = dictionary["files"].map { |file| Source.map(file)}
|
58
59
|
files = files.sort &by_coverage_with_ignored_at_the_end
|
59
60
|
non_ignored_files = Target.select_non_ignored_files(files)
|
60
61
|
|
61
|
-
Target.new(name,
|
62
|
+
Target.new(name, non_ignored_files)
|
62
63
|
end
|
63
64
|
|
64
65
|
def self.by_coverage_with_ignored_at_the_end
|
data/lib/xcov/options.rb
CHANGED
@@ -93,6 +93,14 @@ module Xcov
|
|
93
93
|
default_value: File.join(containing, "xcov_report"),
|
94
94
|
default_value_dynamic: true
|
95
95
|
),
|
96
|
+
FastlaneCore::ConfigItem.new(
|
97
|
+
key: :cloned_source_packages_path,
|
98
|
+
short_option: "-C",
|
99
|
+
env_name: "XCOV_CLONED_SOURCE_PACKAGES_PATH",
|
100
|
+
description: "Sets a custom path for Swift Package Manager dependencies",
|
101
|
+
type: String,
|
102
|
+
optional: true
|
103
|
+
),
|
96
104
|
|
97
105
|
# Report options
|
98
106
|
FastlaneCore::ConfigItem.new(
|
data/lib/xcov/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Vidal
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.141.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.
|
29
|
+
version: 2.141.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 3.0.0
|
@@ -194,7 +194,7 @@ homepage: https://github.com/fastlane-community/xcov
|
|
194
194
|
licenses:
|
195
195
|
- MIT
|
196
196
|
metadata: {}
|
197
|
-
post_install_message:
|
197
|
+
post_install_message:
|
198
198
|
rdoc_options: []
|
199
199
|
require_paths:
|
200
200
|
- lib
|
@@ -209,9 +209,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
|
213
|
-
|
214
|
-
signing_key:
|
212
|
+
rubygems_version: 3.0.3
|
213
|
+
signing_key:
|
215
214
|
specification_version: 4
|
216
215
|
summary: xcov is a friendly visualizer for Xcode's code coverage files
|
217
216
|
test_files: []
|