Skip to content

Commit

Permalink
Merge pull request #7317 from rubygems/release/bundler_2.5.2_rubygems…
Browse files Browse the repository at this point in the history
…_3.5.2

Prepare RubyGems 3.5.2 and Bundler 2.5.2
  • Loading branch information
simi committed Dec 21, 2023
2 parents c944d05 + a4b3b0f commit 0035192
Show file tree
Hide file tree
Showing 334 changed files with 10,747 additions and 299 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ updates:
directory: '/'
schedule:
interval: 'weekly'
groups:
artifacts:
patterns:
- "*-artifact"
- package-ecosystem: 'cargo'
directory: '/test/rubygems/test_gem_ext_cargo_builder/custom_name/ext/custom_name_lib'
schedule:
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ jobs:
- { name: 3, value: 3.0.0 }

include:
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 }, timeout: 90 }
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 }, timeout: 90 }
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 }, timeout: 90 }
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.3, value: 3.3.0-rc1 }, timeout: 90 }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 }, timeout: 90 }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 }, timeout: 90 }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 }, timeout: 90 }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.3, value: 3.3.0-rc1 }, timeout: 90 }

- { os: { name: Windows, value: windows-2022 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 }, timeout: 150 }
- { os: { name: Windows, value: windows-2022 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 }, timeout: 150 }
Expand All @@ -61,9 +61,6 @@ jobs:
- name: Install graphviz (Ubuntu)
run: sudo apt-get install graphviz -y
if: matrix.bundler.value == '' && matrix.os.name == 'Ubuntu'
- name: Install graphviz (macOS)
run: brew install graphviz
if: matrix.bundler.value == '' && matrix.os.name == 'macOS'
- name: Prepare dependencies
run: |
bin/rake spec:parallel_deps
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/realworld-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
- { name: 3, value: 3.0.0 }

include:
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 } }
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 } }
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 } }
- { os: { name: macOS, value: macos-12 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.3, value: 3.3.0-rc1 } }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.0, value: 3.0.6 } }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.1, value: 3.1.4 } }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.2, value: 3.2.2 } }
- { os: { name: macOS, value: macos-13 }, bundler: { name: 2, value: '' }, ruby: { name: ruby-3.3, value: 3.3.0-rc1 } }
env:
RGV: ..
RUBYOPT: --disable-gems
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Run Test
run: bin/rake spec:realworld
- name: Upload used cassettes as artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
name: cassettes-bundler-${{ matrix.bundler.name }}-${{ matrix.os.value }}-${{ matrix.ruby.name }}
path: ./bundler/spec/support/artifice/used_cassettes.txt
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Run Test
run: bin/rake spec:realworld
- name: Upload used cassettes as artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0
with:
name: cassettes-system-rubygems-bundler-${{ matrix.bundler.name }}-${{ matrix.ruby.name }}
path: ./bundler/spec/support/artifice/used_cassettes.txt
Expand All @@ -111,7 +111,7 @@ jobs:
ruby-version: 3.3.0-rc1
bundler: none
- name: Download all used cassettes as artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
uses: actions/download-artifact@f44cd7b40bfd40b6aa1cc1b9b5b7bf03d3c67110 # v4.1.0
with:
path: ./bundler/spec/support/artifice/used_vcr_cassettes
- name: Check unused cassettes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubygems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
os:
- { name: Ubuntu, value: ubuntu-22.04 }
- { name: macOS, value: macos-12 }
- { name: macOS, value: macos-13 }
- { name: Windows, value: windows-2022 }

ruby:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/system-rubygems-bundler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
paths:
- bundler/**
- .github/workflows/system-rubygems-bundler.yml
- .rubocop_bundler.yml

push:
branches:
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# 3.5.2 / 2023-12-21

## Enhancements:

* Support dynamic library loading with extension .so or .o. Pull request
[#7241](https://github.com/rubygems/rubygems/pull/7241) by hogelog
* Installs bundler 2.5.2 as a default gem.

## Performance:

* Replace `object_id` comparison with identity Hash. Pull request
[#7303](https://github.com/rubygems/rubygems/pull/7303) by amomchilov
* Use IO.copy_stream when reading, writing. Pull request
[#6958](https://github.com/rubygems/rubygems/pull/6958) by martinemde

# 3.5.1 / 2023-12-15

## Enhancements:
Expand Down
1 change: 0 additions & 1 deletion Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/lcs_diff.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb
bundler/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb
Expand Down
12 changes: 12 additions & 0 deletions bundler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 2.5.2 (December 21, 2023)

## Enhancements:

- Avoid vendored thor gem polluting the global namespace [#7305](https://github.com/rubygems/rubygems/pull/7305)

## Bug fixes:

- Fix `bundle update --bundler` when latest version does not support current ruby [#7310](https://github.com/rubygems/rubygems/pull/7310)
- Fix incorrect lockfiles being generated in some situations [#7307](https://github.com/rubygems/rubygems/pull/7307)
- Fix incorrect re-resolve messages [#7306](https://github.com/rubygems/rubygems/pull/7306)

# 2.5.1 (December 15, 2023)

## Bug fixes:
Expand Down
30 changes: 19 additions & 11 deletions bundler/lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,15 @@ def most_specific_locked_platform
private :sources

def nothing_changed?
!@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@missing_lockfile_dep && !@unlocking_bundler && !@invalid_lockfile_dep
!@source_changes &&
!@dependency_changes &&
!@new_platform &&
!@path_changes &&
!@local_changes &&
!@missing_lockfile_dep &&
!@unlocking_bundler &&
!@locked_spec_with_missing_deps &&
!@locked_spec_with_invalid_deps
end

def no_resolve_needed?
Expand Down Expand Up @@ -653,7 +661,8 @@ def change_reason
[@local_changes, "the gemspecs for git local gems changed"],
[@missing_lockfile_dep, "your lock file is missing \"#{@missing_lockfile_dep}\""],
[@unlocking_bundler, "an update to the version of Bundler itself was requested"],
[@invalid_lockfile_dep, "your lock file has an invalid dependency \"#{@invalid_lockfile_dep}\""],
[@locked_spec_with_missing_deps, "your lock file includes \"#{@locked_spec_with_missing_deps}\" but not some of its dependencies"],
[@locked_spec_with_invalid_deps, "your lockfile does not satisfy dependencies of \"#{@locked_spec_with_invalid_deps}\""],
].select(&:first).map(&:last).join(", ")
end

Expand Down Expand Up @@ -708,26 +717,25 @@ def converge_locals
end

def check_lockfile
@invalid_lockfile_dep = nil
@missing_lockfile_dep = nil

locked_names = @locked_specs.map(&:name)
@locked_spec_with_invalid_deps = nil
@locked_spec_with_missing_deps = nil

missing = []
invalid = []

@locked_specs.each do |s|
s.dependencies.each do |dep|
next if dep.name == "bundler"
validation = @locked_specs.validate_deps(s)

missing << s unless locked_names.include?(dep.name)
invalid << s if @locked_specs.none? {|spec| dep.matches_spec?(spec) }
end
missing << s if validation == :missing
invalid << s if validation == :invalid
end

if missing.any?
@locked_specs.delete(missing)

@missing_lockfile_dep = missing.first.name
@locked_spec_with_missing_deps = missing.first.name
elsif !@dependency_changes
@missing_lockfile_dep = current_dependencies.find do |d|
@locked_specs[d.name].empty? && d.name != "bundler"
Expand All @@ -737,7 +745,7 @@ def check_lockfile
if invalid.any?
@locked_specs.delete(invalid)

@invalid_lockfile_dep = invalid.first.name
@locked_spec_with_invalid_deps = invalid.first.name
end
end

Expand Down
2 changes: 2 additions & 0 deletions bundler/lib/bundler/lazy_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class LazySpecification
attr_reader :name, :version, :platform
attr_accessor :source, :remote, :force_ruby_platform, :dependencies, :required_ruby_version, :required_rubygems_version

alias_method :runtime_dependencies, :dependencies

def self.from_spec(s)
lazy_spec = new(s.name, s.version, s.platform, s.source)
lazy_spec.dependencies = s.dependencies
Expand Down
4 changes: 4 additions & 0 deletions bundler/lib/bundler/remote_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def dependencies
end
end

def runtime_dependencies
dependencies.select(&:runtime?)
end

def git_version
return unless loaded_from && source.is_a?(Bundler::Source::Git)
" #{source.revision[0..6]}"
Expand Down
2 changes: 1 addition & 1 deletion bundler/lib/bundler/self_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def remote_specs
source = Bundler::Source::Rubygems.new("remotes" => "https://rubygems.org")
source.remote!
source.add_dependency_names("bundler")
source.specs
source.specs.select(&:matches_current_metadata?)
end
end

Expand Down
42 changes: 35 additions & 7 deletions bundler/lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ def for(dependencies, check = false, platforms = [nil])

specs_for_dep.first.dependencies.each do |d|
next if d.type == :development
incomplete = true if d.name != "bundler" && lookup[d.name].empty?
incomplete = true if d.name != "bundler" && lookup[d.name].nil?
deps << [d, dep[1]]
end
else
incomplete = true
end

if incomplete && check
@incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
@incomplete_specs += lookup[name] || [LazySpecification.new(name, nil, nil)]
end
end

Expand All @@ -64,7 +64,9 @@ def complete_platforms!(platforms)
valid_platform = lookup.all? do |_, specs|
spec = specs.first
matching_specs = spec.source.specs.search([spec.name, spec.version])
platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find(&:matches_current_metadata?)
platform_spec = GemHelpers.select_best_platform_match(matching_specs, platform).find do |s|
s.matches_current_metadata? && valid_dependencies?(s)
end

if platform_spec
new_specs << LazySpecification.from_spec(platform_spec)
Expand All @@ -90,9 +92,20 @@ def complete_platforms!(platforms)
platforms
end

def validate_deps(s)
s.runtime_dependencies.each do |dep|
next if dep.name == "bundler"

return :missing unless names.include?(dep.name)
return :invalid if none? {|spec| dep.matches_spec?(spec) }
end

:valid
end

def [](key)
key = key.name if key.respond_to?(:name)
lookup[key].reverse
lookup[key]&.reverse || []
end

def []=(key, value)
Expand Down Expand Up @@ -167,7 +180,7 @@ def delete_by_name(name)
end

def what_required(spec)
unless req = find {|s| s.dependencies.any? {|d| d.type == :runtime && d.name == spec.name } }
unless req = find {|s| s.runtime_dependencies.any? {|d| d.name == spec.name } }
return [spec]
end
what_required(req) << spec
Expand All @@ -193,8 +206,16 @@ def each(&b)
sorted.each(&b)
end

def names
lookup.keys
end

private

def valid_dependencies?(s)
validate_deps(s) == :valid
end

def sorted
rake = @specs.find {|s| s.name == "rake" }
begin
Expand All @@ -213,8 +234,9 @@ def extract_circular_gems(error)

def lookup
@lookup ||= begin
lookup = Hash.new {|h, k| h[k] = [] }
lookup = {}
@specs.each do |s|
lookup[s.name] ||= []
lookup[s.name] << s
end
lookup
Expand All @@ -228,6 +250,8 @@ def tsort_each_node

def specs_for_dependency(dep, platform)
specs_for_name = lookup[dep.name]
return [] unless specs_for_name

matching_specs = if dep.force_ruby_platform
GemHelpers.force_ruby_platform(specs_for_name)
else
Expand All @@ -240,7 +264,11 @@ def specs_for_dependency(dep, platform)
def tsort_each_child(s)
s.dependencies.sort_by(&:name).each do |d|
next if d.type == :development
lookup[d.name].each {|s2| yield s2 }

specs_for_name = lookup[d.name]
next unless specs_for_name

specs_for_name.each {|s2| yield s2 }
end
end
end
Expand Down
3 changes: 0 additions & 3 deletions bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
require_relative "basic"
require_relative "lcs_diff"

class Bundler::Thor
module Shell
# Inherit from Bundler::Thor::Shell::Basic and add set_color behavior. Check
# Bundler::Thor::Shell::Basic to see all available methods.
#
class Color < Basic
include LCSDiff

# Embed in a String to clear all previous ANSI sequences.
CLEAR = "\e[0m"
# The start of an ANSI bold sequence.
Expand Down
3 changes: 0 additions & 3 deletions bundler/lib/bundler/vendor/thor/lib/thor/shell/html.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
require_relative "basic"
require_relative "lcs_diff"

class Bundler::Thor
module Shell
# Inherit from Bundler::Thor::Shell::Basic and add set_color behavior. Check
# Bundler::Thor::Shell::Basic to see all available methods.
#
class HTML < Basic
include LCSDiff

# The start of an HTML bold sequence.
BOLD = "font-weight: bold"

Expand Down
Loading

0 comments on commit 0035192

Please sign in to comment.