bundler 2.5.2 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6a2b30d88cbd8182542e60988d19819d7a99751c256c3cdfb4818dd78686d0f
4
- data.tar.gz: 90b8f7f6f40ce0167c852dde2b2556e723c57bc1f93b03b175557ff8d8f93db3
3
+ metadata.gz: d1486cdeb45a181fff50c3940e818b84c05507d4e29bfe7b0843b6dc15be6213
4
+ data.tar.gz: 111e63453cbc876227f8e702d6c3921bff91707c8705a56c89b78fed7963f618
5
5
  SHA512:
6
- metadata.gz: 05f5ae18dc9d8e4cb36ad2cadbd40c381427fd04d6b854e161fecccfae5ed4c9a4b57451a263f8e5698cd86a05798dc324bcc91a207c8ceeb57fb6cd80e88a90
7
- data.tar.gz: c04850996399dcd36921294ff6949ccfd01a2b2e872285d07e716a069252b009b08a900c04cf9ddfac1147bd60e0d6c5e1c3bda2b340c968bbc69a9dd8a984bb
6
+ metadata.gz: e5e225950c1192971b49fedab22bd2d1703609df034f0fe3a6f71685f864947ea4583c5e6301ebffd0accc8567232d90da9926b532f1729e20db08c94394406c
7
+ data.tar.gz: dab198d801aef8569466dffbfbafe9bdc0fd781ae6ba610a2be13915b85ea2a40984e90d30bc5635a3a3a786a3d78c50672088e8fd8d5094b2058bf975f292c1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 2.5.4 (January 3, 2024)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix resolution when different platform specific gems have different dependencies [#7324](https://github.com/rubygems/rubygems/pull/7324)
6
+
7
+ # 2.5.3 (December 22, 2023)
8
+
9
+ ## Bug fixes:
10
+
11
+ - Fix incorrect error when Gemfile overrides a gemspec development dependency [#7319](https://github.com/rubygems/rubygems/pull/7319)
12
+
1
13
  # 2.5.2 (December 21, 2023)
2
14
 
3
15
  ## Enhancements:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2023-12-21".freeze
8
- @git_commit_sha = "00351925e4".freeze
7
+ @built_at = "2024-01-04".freeze
8
+ @git_commit_sha = "7ffda9ba9b".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -312,10 +312,6 @@ module Bundler
312
312
  end
313
313
  end
314
314
 
315
- def should_complete_platforms?
316
- !lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
317
- end
318
-
319
315
  def spec_git_paths
320
316
  sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
321
317
  end
@@ -517,6 +513,10 @@ module Bundler
517
513
 
518
514
  private
519
515
 
516
+ def should_add_extra_platforms?
517
+ !lockfile_exists? && generic_local_platform_is_ruby? && !Bundler.settings[:force_ruby_platform]
518
+ end
519
+
520
520
  def lockfile_exists?
521
521
  lockfile && File.exist?(lockfile)
522
522
  end
@@ -600,7 +600,9 @@ module Bundler
600
600
  result = SpecSet.new(resolver.start)
601
601
 
602
602
  @resolved_bundler_version = result.find {|spec| spec.name == "bundler" }&.version
603
- @platforms = result.complete_platforms!(platforms) if should_complete_platforms?
603
+ @platforms = result.add_extra_platforms!(platforms) if should_add_extra_platforms?
604
+
605
+ result.complete_platforms!(platforms)
604
606
 
605
607
  SpecSet.new(result.for(dependencies, false, @platforms))
606
608
  end
@@ -68,6 +68,10 @@ module Bundler
68
68
  @should_include && current_env? && current_platform?
69
69
  end
70
70
 
71
+ def gemspec_dev_dep?
72
+ type == :development
73
+ end
74
+
71
75
  def current_env?
72
76
  return true unless @env
73
77
  if @env.is_a?(Hash)
data/lib/bundler/dsl.rb CHANGED
@@ -103,16 +103,21 @@ module Bundler
103
103
  # if there's already a dependency with this name we try to prefer one
104
104
  if current = @dependencies.find {|d| d.name == dep.name }
105
105
  # Always prefer the dependency from the Gemfile
106
- deleted_dep = @dependencies.delete(current) if current.type == :development
106
+ @dependencies.delete(current) if current.gemspec_dev_dep?
107
107
 
108
108
  if current.requirement != dep.requirement
109
109
  current_requirement_open = current.requirements_list.include?(">= 0")
110
110
 
111
- if current.type == :development
112
- unless current_requirement_open || dep.type == :development
113
- Bundler.ui.warn "A gemspec development dependency (#{dep.name}, #{current.requirement}) is being overridden by a Gemfile dependency (#{dep.name}, #{dep.requirement}).\n" \
114
- "This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n" \
111
+ gemspec_dep = [dep, current].find(&:gemspec_dev_dep?)
112
+ if gemspec_dep
113
+ gemfile_dep = [dep, current].find(&:runtime?)
114
+
115
+ unless current_requirement_open
116
+ Bundler.ui.warn "A gemspec development dependency (#{gemspec_dep.name}, #{gemspec_dep.requirement}) is being overridden by a Gemfile dependency (#{gemfile_dep.name}, #{gemfile_dep.requirement}).\n" \
117
+ "This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement\n"
115
118
  end
119
+
120
+ return if dep.gemspec_dev_dep?
116
121
  else
117
122
  update_prompt = ""
118
123
 
@@ -130,8 +135,8 @@ module Bundler
130
135
  "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
131
136
  "#{update_prompt}"
132
137
  end
133
- elsif current.type == :development || dep.type == :development
134
- return if deleted_dep.nil?
138
+ elsif current.gemspec_dev_dep? || dep.gemspec_dev_dep?
139
+ return if dep.gemspec_dev_dep?
135
140
  elsif current.source != dep.source
136
141
  raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
137
142
  "You specified that #{dep.name} (#{dep.requirement}) should come from " \
@@ -52,32 +52,14 @@ module Bundler
52
52
  specs.uniq
53
53
  end
54
54
 
55
- def complete_platforms!(platforms)
55
+ def add_extra_platforms!(platforms)
56
56
  return platforms.concat([Gem::Platform::RUBY]).uniq if @specs.empty?
57
57
 
58
- new_platforms = @specs.flat_map {|spec| spec.source.specs.search([spec.name, spec.version]).map(&:platform) }.uniq.select do |platform|
58
+ new_platforms = all_platforms.select do |platform|
59
59
  next if platforms.include?(platform)
60
60
  next unless GemHelpers.generic(platform) == Gem::Platform::RUBY
61
61
 
62
- new_specs = []
63
-
64
- valid_platform = lookup.all? do |_, specs|
65
- spec = specs.first
66
- matching_specs = spec.source.specs.search([spec.name, spec.version])
67
- platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find do |s|
68
- s.matches_current_metadata? && valid_dependencies?(s)
69
- end
70
-
71
- if platform_spec
72
- new_specs << LazySpecification.from_spec(platform_spec)
73
- true
74
- else
75
- false
76
- end
77
- end
78
- next unless valid_platform
79
-
80
- @specs.concat(new_specs.uniq)
62
+ complete_platform(platform)
81
63
  end
82
64
  return platforms if new_platforms.empty?
83
65
 
@@ -86,12 +68,15 @@ module Bundler
86
68
  less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && platform === Bundler.local_platform }
87
69
  platforms.delete(Bundler.local_platform) if less_specific_platform
88
70
 
89
- @sorted = nil
90
- @lookup = nil
91
-
92
71
  platforms
93
72
  end
94
73
 
74
+ def complete_platforms!(platforms)
75
+ platforms.each do |platform|
76
+ complete_platform(platform)
77
+ end
78
+ end
79
+
95
80
  def validate_deps(s)
96
81
  s.runtime_dependencies.each do |dep|
97
82
  next if dep.name == "bundler"
@@ -110,14 +95,14 @@ module Bundler
110
95
 
111
96
  def []=(key, value)
112
97
  @specs << value
113
- @lookup = nil
114
- @sorted = nil
98
+
99
+ reset!
115
100
  end
116
101
 
117
102
  def delete(specs)
118
103
  specs.each {|spec| @specs.delete(spec) }
119
- @lookup = nil
120
- @sorted = nil
104
+
105
+ reset!
121
106
  end
122
107
 
123
108
  def sort!
@@ -175,8 +160,8 @@ module Bundler
175
160
 
176
161
  def delete_by_name(name)
177
162
  @specs.reject! {|spec| spec.name == name }
178
- @lookup = nil
179
- @sorted = nil
163
+
164
+ reset!
180
165
  end
181
166
 
182
167
  def what_required(spec)
@@ -212,6 +197,42 @@ module Bundler
212
197
 
213
198
  private
214
199
 
200
+ def reset!
201
+ @sorted = nil
202
+ @lookup = nil
203
+ end
204
+
205
+ def complete_platform(platform)
206
+ new_specs = []
207
+
208
+ valid_platform = lookup.all? do |_, specs|
209
+ spec = specs.first
210
+ matching_specs = spec.source.specs.search([spec.name, spec.version])
211
+ platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find do |s|
212
+ s.matches_current_metadata? && valid_dependencies?(s)
213
+ end
214
+
215
+ if platform_spec
216
+ new_specs << LazySpecification.from_spec(platform_spec) unless specs.include?(platform_spec)
217
+ true
218
+ else
219
+ false
220
+ end
221
+ end
222
+
223
+ if valid_platform && new_specs.any?
224
+ @specs.concat(new_specs)
225
+
226
+ reset!
227
+ end
228
+
229
+ valid_platform
230
+ end
231
+
232
+ def all_platforms
233
+ @specs.flat_map {|spec| spec.source.specs.search([spec.name, spec.version]).map(&:platform) }.uniq
234
+ end
235
+
215
236
  def valid_dependencies?(s)
216
237
  validate_deps(s) == :valid
217
238
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.2".freeze
4
+ VERSION = "2.5.4".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.2
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2023-12-21 00:00:00.000000000 Z
25
+ date: 2024-01-04 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -398,7 +398,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
398
398
  - !ruby/object:Gem::Version
399
399
  version: 3.2.3
400
400
  requirements: []
401
- rubygems_version: 3.5.2
401
+ rubygems_version: 3.5.4
402
402
  signing_key:
403
403
  specification_version: 4
404
404
  summary: The best way to manage your application's dependencies