slather 2.8.5 → 2.8.7

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: 8b31a46c5d0af53d36513b448201896c97d6fb17724367390f65e4f7ced63101
4
- data.tar.gz: c5f8496a737ec10a79294a07b6da6a45676257aa9050f70879f0b3c51aa7b0bd
3
+ metadata.gz: ca4e8b83423e7a0670664bc121452d3954b5a50eed6395e9df3b09eff82ea7a0
4
+ data.tar.gz: 4b1663cd54b9dbcc08e32334bd4f994f1934d44c3b290e271a79d15567428719
5
5
  SHA512:
6
- metadata.gz: 9df9cc272e6528f31f72df7acdd8f747bd502db70785b90b388ca92a140ffb8e2fac6c10d76eecee098da6225645c5f70dc77c365a52ec7df19992d744fbc91e
7
- data.tar.gz: 7bc423a81f24a7faffa30f00941ada25fb1df3b19a11e26edbb74ff7efea4ff0e239fece6ffd7698dac14ee7e128896bf048d204be5e7a851e3ec35e7de0935f
6
+ metadata.gz: d1984c8e3bd02944363e7f84806fd2118c98138fa0f1d017b0dafddf0e4300741f3ae66d0fece7a4f6a585e04646829c50e1e93100236eb032cb7190b4c44eef
7
+ data.tar.gz: 2c3b9d016a6eff481d824df68d7c0f05ecb5d34096829eceee4105d4847a5c02df6d69206458f1f8f54a092a453ea4d38265e6f1d72f6c1a66252f64dce4ad39
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v2.8.7
4
+
5
+ * Restore scheme coverage directory lookup in profdata_coverage_dir
6
+ [MirekNalepa](https://github.com/MirekNalepa)
7
+ [#587](https://github.com/SlatherOrg/slather/pull/587)
8
+
9
+ ## v2.8.6
10
+
11
+ * Apply dedupe to profdata coverage as well
12
+ [RoySRodney](https://github.com/RoySRodney)
13
+ [#579](https://github.com/SlatherOrg/slather/pull/579)
14
+
15
+ * Add Swift Package support
16
+ [michel-moreau](https://github.com/michel-moreau)
17
+ [#584](https://github.com/SlatherOrg/slather/pull/584)
18
+
19
+ * Bump nokogiri minimum version to fix security advisories
20
+ [carloskvasir](https://github.com/carloskvasir)
21
+ [#585](https://github.com/SlatherOrg/slather/pull/585)
22
+
3
23
  ## v2.8.5
4
24
 
5
25
  * Update xcodeproj to 1.27.1 to support Xcode 16 folder references
@@ -113,6 +113,8 @@ class CoverageCommand < Clamp::Command
113
113
  xcodeproj_path_to_open = xcodeproj_path || Slather::Project.yml["xcodeproj"]
114
114
  if xcodeproj_path_to_open
115
115
  project = Slather::Project.open(xcodeproj_path_to_open)
116
+ elsif File.exist?("Package.swift")
117
+ project = Slather::Project.open(".")
116
118
  else
117
119
  raise StandardError, "Must provide an xcodeproj either via the 'slather [SUBCOMMAND] [PROJECT].xcodeproj' command or through .slather.yml"
118
120
  end
@@ -50,7 +50,11 @@ module Slather
50
50
  alias_method :setup_for_coverage, :slather_setup_for_coverage
51
51
 
52
52
  def self.open(xcodeproj)
53
- proj = super
53
+ if File.directory?(xcodeproj) && File.exist?(File.join(xcodeproj, "Package.swift"))
54
+ proj = self.new(xcodeproj)
55
+ else
56
+ proj = super
57
+ end
54
58
  proj.xcodeproj = xcodeproj
55
59
  proj
56
60
  end
@@ -86,7 +90,11 @@ module Slather
86
90
  end
87
91
 
88
92
  if derived_data_path == nil
89
- derived_data_path = File.expand_path('~') + "/Library/Developer/Xcode/DerivedData/"
93
+ if File.exist?(File.join(self.xcodeproj, "Package.swift"))
94
+ derived_data_path = File.join(self.xcodeproj, ".build")
95
+ else
96
+ derived_data_path = File.expand_path('~') + "/Library/Developer/Xcode/DerivedData/"
97
+ end
90
98
  end
91
99
 
92
100
  derived_data_path
@@ -126,7 +134,11 @@ module Slather
126
134
  end
127
135
  end
128
136
 
129
- coverage_files
137
+ if coverage_files.empty?
138
+ raise StandardError, "No coverage files found."
139
+ else
140
+ dedupe(coverage_files)
141
+ end
130
142
  end
131
143
  private :profdata_coverage_files
132
144
 
@@ -201,10 +213,13 @@ module Slather
201
213
  private :create_profdata
202
214
 
203
215
  def remove_extension(path)
216
+ return "" if self.products.nil? || self.products.empty?
204
217
  path.split(".")[0..-2].join(".")
205
218
  end
206
219
 
207
220
  def first_product_name
221
+ # If products is nil it means we are likely using a Swift Package and not an xcodeproj
222
+ return "" if self.products.nil? || self.products.empty?
208
223
  first_product = self.products.first
209
224
  # If name is not available it computes it using
210
225
  # the path by dropping the 'extension' of the path.
@@ -221,6 +236,11 @@ module Slather
221
236
  dir = Dir[File.join(build_directory,"/**/#{first_product_name}")].first
222
237
  end
223
238
 
239
+ if dir == nil
240
+ # Swift Package Manager
241
+ dir = Dir[File.join(build_directory,"/**/codecov")].first
242
+ end
243
+
224
244
  if dir == nil
225
245
  # Xcode 7.3 moved the location of Coverage.profdata
226
246
  dir = Dir[File.join(build_directory,"/**/CodeCoverage")].first
@@ -379,6 +399,9 @@ module Slather
379
399
  end
380
400
 
381
401
  def configure_output_directory
402
+ if self.source_directory.nil? && File.exist?(File.join(self.xcodeproj, "Package.swift"))
403
+ self.source_directory = self.xcodeproj
404
+ end
382
405
  self.output_directory ||= self.class.yml["output_directory"] if self.class.yml["output_directory"]
383
406
  end
384
407
 
@@ -1,3 +1,3 @@
1
1
  module Slather
2
- VERSION = '2.8.5' unless defined?(Slather::VERSION)
2
+ VERSION = '2.8.7' unless defined?(Slather::VERSION)
3
3
  end
data/slather.gemspec CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_dependency 'clamp', '~> 1.3'
31
31
  spec.add_dependency 'xcodeproj', '~> 1.27'
32
- spec.add_dependency 'nokogiri', '>= 1.14.3'
32
+ spec.add_dependency 'nokogiri', '>= 1.19.4'
33
33
  spec.add_dependency 'CFPropertyList', '>= 2.2', '< 4'
34
34
 
35
35
  spec.add_runtime_dependency 'activesupport'
@@ -188,6 +188,31 @@ describe Slather::Project do
188
188
  end
189
189
  end
190
190
 
191
+ describe "#profdata_coverage_dir" do
192
+ before(:each) do
193
+ fixtures_project.build_directory = "/some/build"
194
+ fixtures_project.scheme = "fixtures"
195
+ allow(File).to receive(:exist?).and_call_original
196
+ allow(File).to receive(:exist?).with("/some/build").and_return(true)
197
+ allow(Dir).to receive(:[]).and_call_original
198
+ end
199
+
200
+ it "should return the CodeCoverage scheme directory when a scheme is set" do
201
+ allow(Dir).to receive(:[]).with("/some/build/**/CodeCoverage/fixtures").and_return(["/some/build/Build/Intermediates/CodeCoverage/fixtures"])
202
+ expect(fixtures_project.profdata_coverage_dir).to eq("/some/build/Build/Intermediates/CodeCoverage/fixtures")
203
+ end
204
+
205
+ it "should fall back to the ProfileData directory when a scheme is set on Xcode 9 and later" do
206
+ allow(Slather).to receive(:xcode_version).and_return([16, 0])
207
+ allow(Dir).to receive(:[]).with("/some/build/**/CodeCoverage/fixtures").and_return([])
208
+ allow(Dir).to receive(:[]).with("/some/build/**/codecov").and_return([])
209
+ allow(Dir).to receive(:[]).with("/some/build/**/CodeCoverage").and_return([])
210
+ allow(Dir).to receive(:[]).with("/some/build/**/ProfileData/*/Coverage.profdata").and_return(["/some/build/ProfileData/ABC/Coverage.profdata"])
211
+ expect(Dir).not_to receive(:[]).with("/some/build/**/fixtures")
212
+ expect(fixtures_project.profdata_coverage_dir).to eq(Pathname.new("/some/build/ProfileData/ABC"))
213
+ end
214
+ end
215
+
191
216
  describe "#invalid_characters" do
192
217
  it "should correctly encode invalid characters" do
193
218
  allow(fixtures_project).to receive(:input_format).and_return("profdata")
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slather
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.5
4
+ version: 2.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Larsen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -170,14 +169,14 @@ dependencies:
170
169
  requirements:
171
170
  - - ">="
172
171
  - !ruby/object:Gem::Version
173
- version: 1.14.3
172
+ version: 1.19.4
174
173
  type: :runtime
175
174
  prerelease: false
176
175
  version_requirements: !ruby/object:Gem::Requirement
177
176
  requirements:
178
177
  - - ">="
179
178
  - !ruby/object:Gem::Version
180
- version: 1.14.3
179
+ version: 1.19.4
181
180
  - !ruby/object:Gem::Dependency
182
181
  name: CFPropertyList
183
182
  requirement: !ruby/object:Gem::Requirement
@@ -212,7 +211,6 @@ dependencies:
212
211
  - - ">="
213
212
  - !ruby/object:Gem::Version
214
213
  version: '0'
215
- description:
216
214
  email:
217
215
  - mark@venmo.com
218
216
  executables:
@@ -326,7 +324,6 @@ homepage: https://github.com/SlatherOrg/slather
326
324
  licenses:
327
325
  - MIT
328
326
  metadata: {}
329
- post_install_message:
330
327
  rdoc_options: []
331
328
  require_paths:
332
329
  - lib
@@ -341,8 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
338
  - !ruby/object:Gem::Version
342
339
  version: '0'
343
340
  requirements: []
344
- rubygems_version: 3.5.18
345
- signing_key:
341
+ rubygems_version: 4.0.22
346
342
  specification_version: 4
347
343
  summary: Test coverage reports for Xcode projects
348
344
  test_files: