xcov 1.6.0 → 1.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36baa2a5175fb9d5664e322d39a9bb3110cde70e672ed6c3a5c858f725478da7
4
- data.tar.gz: 34287b2a2cbf7fe408d1eaf39e8cc414c87a2ef3c873c4d6f6cd3535afcfe592
3
+ metadata.gz: 0b96135c42bcad3bc99bd0a7bd8a703311df3455e99c8c3b303bc20b7b43d1fe
4
+ data.tar.gz: af66a0c17ae43ced2ddce57187c7baf9764e48d90f2c9836f01e371a11265adb
5
5
  SHA512:
6
- metadata.gz: d5963ae1495ec0de0c0b10d3fda2ed1c6431319c009cb5098d54a2aacc9fae8506e30301fc6c713459934462b28deeace8d5b2c584da8d9fa9aba4c8f1c0a80b
7
- data.tar.gz: 2f4277eb3eabf9433f38914ad607b9365a90c83120b738dc8bb8fb43993cda09fd67e3ef53ddc1f51adf4ce7dd6473b1a0062e2e66bde31a0c60a60ad8db6ec1
6
+ metadata.gz: 2ecbcbdd82fd7abaef6c34c2f7631ca88af1482d77c85074e2a6e7c07bce6fab54dc25bddaf7c676794e8203bf4fe8937b4ee03449577926eb03d11a96f422da
7
+ data.tar.gz: b185daa8cb390aab36b322bb8b127668f036a0ebba509d43aa43c1ae8228845e54e69a18e6fa1bd207470c2e9a0f5d39c52005982404b2ace02364a85d3564d6
Binary file
@@ -1,5 +1,5 @@
1
1
  module Xcov
2
2
  module Core
3
- VERSION = "0.7"
3
+ VERSION = "0.8"
4
4
  end
5
5
  end
@@ -38,6 +38,11 @@ module Xcov
38
38
  end
39
39
 
40
40
  def parse_xccoverage
41
+ xccoverage_files = []
42
+
43
+ # xcresults to parse and export after collecting
44
+ xcresults_to_parse_and_export = []
45
+
41
46
  # Find .xccoverage file
42
47
  # If no xccov direct path, use the old derived data path method
43
48
  if xccov_file_direct_paths.nil?
@@ -48,17 +53,36 @@ module Xcov
48
53
  if xccoverage_files.empty?
49
54
  xcresult_paths = Dir["#{test_logs_path}*.xcresult"].sort_by { |filename| File.mtime(filename) }.reverse
50
55
  xcresult_paths.each do |xcresult_path|
51
- xccoverage_files += export_paths_from_xcresult!(xcresult_path)
56
+ xcresults_to_parse_and_export << xcresult_path
52
57
  end
53
58
  end
54
59
 
55
- unless test_logs_path.directory? && !xccoverage_files.empty?
60
+ unless test_logs_path.directory?
56
61
  ErrorHandler.handle_error("XccoverageFileNotFound")
57
62
  end
58
63
  else
59
- xccoverage_files = xccov_file_direct_paths
64
+ # Iterate over direct paths and find .xcresult files
65
+ # that need to be processed before getting coverage
66
+ xccov_file_direct_paths.each do |path|
67
+ if File.extname(path) == '.xcresult'
68
+ xcresults_to_parse_and_export << path
69
+ else
70
+ xccoverage_files << path
71
+ end
72
+ end
73
+ end
74
+
75
+ # Iterates over xcresults
76
+ # Exports .xccovarchives
77
+ # Exports .xccovreports and collects the paths
78
+ unless xcresults_to_parse_and_export.empty?
79
+ xccoverage_files = process_xcresults!(xcresults_to_parse_and_export)
60
80
  end
61
81
 
82
+ # Errors if no coverage files were found
83
+ if xccoverage_files.empty?
84
+ ErrorHandler.handle_error("XccoverageFileNotFound")
85
+ end
62
86
 
63
87
  # Convert .xccoverage file to json
64
88
  ide_foundation_path = Xcov.config[:legacy_support] ? nil : Xcov.config[:ideFoundationPath]
@@ -172,21 +196,36 @@ module Xcov
172
196
  end
173
197
 
174
198
  path = Xcov.config[:xccov_file_direct_path]
175
- if File.extname(path) == '.xcresult'
176
- return export_paths_from_xcresult!(path)
177
- end
178
-
179
199
  return [Pathname.new(path).to_s]
180
200
  end
181
201
 
182
- def export_paths_from_xcresult!(path)
183
- parser = XCResult::Parser.new(path: path)
184
- return parser.export_xccovreports(destination: Dir.mktmpdir)
185
- rescue
186
- UI.error("Error occured while exporting xccovreport from xcresult '#{path}'")
187
- UI.error("Make sure you have both Xcode 11 selected and pointing to the correct xcresult file")
188
- UI.crash!("Failed to export xccovreport from xcresult'")
189
- end
202
+ def process_xcresults!(xcresult_paths)
203
+ output_path = Xcov.config[:output_directory]
204
+ FileUtils.mkdir_p(output_path)
205
+
206
+ return xcresult_paths.flat_map do |xcresult_path|
207
+ begin
208
+ parser = XCResult::Parser.new(path: xcresult_path)
209
+
210
+ # Exporting to same directory as xcresult
211
+ archive_paths = parser.export_xccovarchives(destination: output_path)
212
+ report_paths = parser.export_xccovreports(destination: output_path)
213
+
214
+ # Informating user of export paths
215
+ archive_paths.each do |path|
216
+ UI.important("Copying .xccovarchive to #{path}")
217
+ end
218
+ report_paths.each do |path|
219
+ UI.important("Copying .xccovreport to #{path}")
220
+ end
190
221
 
222
+ report_paths
223
+ rescue
224
+ UI.error("Error occured while exporting xccovreport from xcresult '#{xcresult_path}'")
225
+ UI.error("Make sure you have both Xcode 11 selected and pointing to the correct xcresult file")
226
+ UI.crash!("Failed to export xccovreport from xcresult'")
227
+ end
228
+ end
229
+ end
191
230
  end
192
231
  end
@@ -1,6 +1,6 @@
1
1
  module Xcov
2
2
 
3
- VERSION = "1.6.0"
3
+ VERSION = "1.7.0"
4
4
  DESCRIPTION = "xcov is a friendly visualizer for Xcode's code coverage files"
5
5
 
6
6
  end
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.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Vidal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-17 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 0.1.1
95
+ version: 0.2.0
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 0.1.1
102
+ version: 0.2.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: bundler
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -190,7 +190,7 @@ files:
190
190
  - views/function.erb
191
191
  - views/report.erb
192
192
  - views/target.erb
193
- homepage: https://github.com/nakiostudio/xcov
193
+ homepage: https://github.com/fastlane-community/xcov
194
194
  licenses:
195
195
  - MIT
196
196
  metadata: {}
@@ -209,7 +209,8 @@ 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.3
212
+ rubyforge_project:
213
+ rubygems_version: 2.7.6
213
214
  signing_key:
214
215
  specification_version: 4
215
216
  summary: xcov is a friendly visualizer for Xcode's code coverage files