xcov 1.7.4 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xcov/manager.rb +57 -17
- data/lib/xcov/version.rb +1 -1
- metadata +3 -3
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/manager.rb
CHANGED
@@ -49,11 +49,13 @@ module Xcov
|
|
49
49
|
# If no xccov direct path, use the old derived data path method
|
50
50
|
if xccov_file_direct_paths.nil?
|
51
51
|
extension = Xcov.config[:legacy_support] ? "xccoverage" : "xccovreport"
|
52
|
+
|
52
53
|
test_logs_path = derived_data_path + "Logs/Test/"
|
53
|
-
|
54
|
-
|
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}"]
|
55
57
|
if xccoverage_files.empty?
|
56
|
-
xcresult_paths = Dir["#{test_logs_path}*.xcresult"]
|
58
|
+
xcresult_paths = Dir["#{test_logs_path}*.xcresult"]
|
57
59
|
xcresult_paths.each do |xcresult_path|
|
58
60
|
xcresults_to_parse_and_export << xcresult_path
|
59
61
|
end
|
@@ -77,6 +79,7 @@ module Xcov
|
|
77
79
|
# Iterates over xcresults
|
78
80
|
# Exports .xccovarchives
|
79
81
|
# Exports .xccovreports and collects the paths
|
82
|
+
# Merge .xccovreports if multiple exists and return merged report
|
80
83
|
unless xcresults_to_parse_and_export.empty?
|
81
84
|
xccoverage_files = process_xcresults!(xcresults_to_parse_and_export)
|
82
85
|
end
|
@@ -88,6 +91,7 @@ module Xcov
|
|
88
91
|
|
89
92
|
# Convert .xccoverage file to json
|
90
93
|
ide_foundation_path = Xcov.config[:legacy_support] ? nil : Xcov.config[:ideFoundationPath]
|
94
|
+
xccoverage_files = xccoverage_files.sort_by {|filename| File.mtime(filename)}.reverse
|
91
95
|
json_report = Xcov::Core::Parser.parse(xccoverage_files.first, Xcov.config[:output_directory], ide_foundation_path)
|
92
96
|
ErrorHandler.handle_error("UnableToParseXccoverageFile") if json_report.nil?
|
93
97
|
|
@@ -204,30 +208,66 @@ module Xcov
|
|
204
208
|
def process_xcresults!(xcresult_paths)
|
205
209
|
output_path = Xcov.config[:output_directory]
|
206
210
|
FileUtils.mkdir_p(output_path)
|
207
|
-
|
208
|
-
|
211
|
+
|
212
|
+
result_path = ""
|
213
|
+
index = 0
|
214
|
+
|
215
|
+
xcresult_paths.flat_map do |xcresult_path|
|
209
216
|
begin
|
210
217
|
parser = XCResult::Parser.new(path: xcresult_path)
|
211
|
-
|
218
|
+
|
212
219
|
# Exporting to same directory as xcresult
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
#
|
217
|
-
|
218
|
-
|
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
|
219
228
|
end
|
220
|
-
report_paths.each do |path|
|
221
|
-
UI.important("Copying .xccovreport to #{path}")
|
222
|
-
end
|
223
|
-
|
224
|
-
report_paths
|
225
229
|
rescue
|
226
230
|
UI.error("Error occured while exporting xccovreport from xcresult '#{xcresult_path}'")
|
227
231
|
UI.error("Make sure you have both Xcode 11 selected and pointing to the correct xcresult file")
|
228
232
|
UI.crash!("Failed to export xccovreport from xcresult'")
|
229
233
|
end
|
230
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
|
231
271
|
end
|
232
272
|
end
|
233
273
|
end
|
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
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.0.
|
212
|
+
rubygems_version: 3.0.3
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: xcov is a friendly visualizer for Xcode's code coverage files
|