Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions lib/bundler/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,13 @@ def normalize_options(name, version, opts)
next if VALID_PLATFORMS.include?(p)
raise GemfileError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}"
end
deprecate_legacy_windows_platforms(platforms)

windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
if windows_platforms.any?
windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
Bundler::SharedHelpers.feature_removed! removed_message
end

# Save sources passed in a key
if opts.key?("source")
Expand Down Expand Up @@ -492,16 +498,6 @@ def normalize_source(source)
end
end

def deprecate_legacy_windows_platforms(platforms)
windows_platforms = platforms.select {|pl| pl.to_s.match?(/mingw|mswin/) }
return if windows_platforms.empty?

windows_platforms = windows_platforms.map! {|pl| ":#{pl}" }.join(", ")
message = "Platform #{windows_platforms} is deprecated. Please use platform :windows instead."
removed_message = "Platform #{windows_platforms} has been removed. Please use platform :windows instead."
Bundler::SharedHelpers.major_deprecation 2, message, removed_message: removed_message
end

def check_path_source_safety
return if @sources.global_path_source.nil?

Expand Down
14 changes: 2 additions & 12 deletions lib/bundler/lockfile_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,8 @@ def initialize(lockfile, strict: false)
@pos.advance!(line)
end

if !Bundler.frozen_bundle? && @platforms.include?(Gem::Platform::X64_MINGW_LEGACY)
if @platforms.include?(Gem::Platform::X64_MINGW)
@platforms.delete(Gem::Platform::X64_MINGW_LEGACY)
SharedHelpers.major_deprecation(2,
"Found x64-mingw32 in lockfile, which is deprecated. Removing it. Support for x64-mingw32 will be removed in Bundler 4.0.",
removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
else
@platforms[@platforms.index(Gem::Platform::X64_MINGW_LEGACY)] = Gem::Platform::X64_MINGW
SharedHelpers.major_deprecation(2,
"Found x64-mingw32 in lockfile, which is deprecated. Using x64-mingw-ucrt, the replacement for x64-mingw32 in modern rubies, instead. Support for x64-mingw32 will be removed in Bundler 4.0.",
removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
end
if @platforms.include?(Gem::Platform::X64_MINGW_LEGACY)
SharedHelpers.feature_removed!("Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
end

@most_specific_locked_platform = @platforms.min_by do |bundle_platform|
Expand Down
13 changes: 4 additions & 9 deletions lib/bundler/spec_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,11 @@ def initialize(specs)
@specs = specs
end

def for(dependencies, platforms_or_legacy_check = [nil], legacy_platforms = [nil], skips: [])
platforms = if [true, false].include?(platforms_or_legacy_check)
Bundler::SharedHelpers.major_deprecation 2,
def for(dependencies, platforms = [nil], legacy_platforms = [nil], skips: [])
if [true, false].include?(platforms)
Bundler::SharedHelpers.feature_removed! \
"SpecSet#for received a `check` parameter, but that's no longer used and deprecated. " \
"SpecSet#for always implicitly performs validation. Please remove this parameter",
print_caller_location: true

legacy_platforms
else
platforms_or_legacy_check
"SpecSet#for always implicitly performs validation. Please remove this parameter"
end

materialize_dependencies(dependencies, platforms, skips: skips)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/specification_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def stubs_for_pattern(pattern, match_platform = true)
end

##
# Adds +spec+ to the the record, keeping the collection properly sorted.
# Adds +spec+ to the record, keeping the collection properly sorted.

def add_spec(spec)
return if all.include? spec
Expand Down
8 changes: 4 additions & 4 deletions spec/bundler/bundler/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@
to raise_error(Bundler::GemfileError, /is not a valid platform/)
end

it "raises a deprecation warning for legacy windows platforms" do
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, /\APlatform :mswin, :x64_mingw is deprecated/, removed_message: /\APlatform :mswin, :x64_mingw has been removed/)
it "raises an error for legacy windows platforms" do
expect(Bundler::SharedHelpers).to receive(:feature_removed!).with(/\APlatform :mswin, :x64_mingw has been removed/)
subject.gem("foo", platforms: [:mswin, :jruby, :x64_mingw])
end

Expand Down Expand Up @@ -291,8 +291,8 @@
end

describe "#platforms" do
it "raises a deprecation warning for legacy windows platforms" do
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(2, /\APlatform :mswin64, :mingw is deprecated/, removed_message: /\APlatform :mswin64, :mingw has been removed/)
it "raises an error for legacy windows platforms" do
expect(Bundler::SharedHelpers).to receive(:feature_removed!).with(/\APlatform :mswin64, :mingw has been removed/)
subject.platforms(:mswin64, :jruby, :mingw) do
subject.gem("foo")
end
Expand Down
128 changes: 0 additions & 128 deletions spec/bundler/bundler/lockfile_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,134 +95,6 @@
end
end

describe "X64_MINGW_LEGACY platform handling" do
before { allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app("gems.rb")) }

describe "when X64_MINGW_LEGACY is present alone" do
let(:lockfile_with_legacy_platform) { <<~L }
GEM
remote: https://rubygems.org/
specs:
rake (10.3.2)

PLATFORMS
ruby
x64-mingw32

DEPENDENCIES
rake

BUNDLED WITH
3.6.9
L

context "when bundle is not frozen" do
before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) }
subject { described_class.new(lockfile_with_legacy_platform) }

it "replaces X64_MINGW_LEGACY with X64_MINGW" do
allow(Bundler::SharedHelpers).to receive(:major_deprecation)
expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt")
expect(subject.platforms.map(&:to_s)).not_to include("x64-mingw32")
end

it "shows deprecation warning for replacement" do
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(
2,
"Found x64-mingw32 in lockfile, which is deprecated. Using x64-mingw-ucrt, the replacement for x64-mingw32 in modern rubies, instead. Support for x64-mingw32 will be removed in Bundler 4.0.",
removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0."
)
subject
end
end

context "when bundle is frozen" do
before { allow(Bundler).to receive(:frozen_bundle?).and_return(true) }
subject { described_class.new(lockfile_with_legacy_platform) }

it "preserves X64_MINGW_LEGACY platform without replacement" do
expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw32")
end

it "does not show any deprecation warnings" do
expect(Bundler::SharedHelpers).not_to receive(:major_deprecation)
subject
end
end
end

describe "when both X64_MINGW_LEGACY and X64_MINGW are present" do
let(:lockfile_with_both_platforms) { <<~L }
GEM
remote: https://rubygems.org/
specs:
rake (10.3.2)

PLATFORMS
ruby
x64-mingw32
x64-mingw-ucrt

DEPENDENCIES
rake

BUNDLED WITH
3.6.9
L

context "when bundle is not frozen" do
before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) }
subject { described_class.new(lockfile_with_both_platforms) }

it "removes X64_MINGW_LEGACY and keeps X64_MINGW" do
allow(Bundler::SharedHelpers).to receive(:major_deprecation)
expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt")
expect(subject.platforms.map(&:to_s)).not_to include("x64-mingw32")
end

it "shows deprecation warning for removing legacy platform" do
expect(Bundler::SharedHelpers).to receive(:major_deprecation).with(
2,
"Found x64-mingw32 in lockfile, which is deprecated. Removing it. Support for x64-mingw32 will be removed in Bundler 4.0.",
removed_message: "Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0."
)
subject
end
end
end

describe "when no X64_MINGW_LEGACY platform is present" do
let(:lockfile_with_modern_platforms) { <<~L }
GEM
remote: https://rubygems.org/
specs:
rake (10.3.2)

PLATFORMS
ruby
x64-mingw-ucrt

DEPENDENCIES
rake

BUNDLED WITH
3.6.9
L

before { allow(Bundler).to receive(:frozen_bundle?).and_return(false) }
subject { described_class.new(lockfile_with_modern_platforms) }

it "preserves all modern platforms without changes" do
expect(subject.platforms.map(&:to_s)).to contain_exactly("ruby", "x64-mingw-ucrt")
end

it "does not show any deprecation warnings" do
expect(Bundler::SharedHelpers).not_to receive(:major_deprecation)
subject
end
end
end

describe "#initialize" do
before { allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app("gems.rb")) }
subject { described_class.new(lockfile_contents) }
Expand Down
11 changes: 0 additions & 11 deletions spec/bundler/commands/cache_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,17 +207,6 @@
expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).to exist
end

it "prints an error when using legacy windows rubies" do
gemfile <<-D
source "https://gem.repo1"
gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20]
D

bundle "cache --all-platforms", raise_on_error: false
expect(err).to include("removed")
expect(bundled_app("vendor/cache/myrack-1.0.0.gem")).not_to exist
end

it "does not attempt to install gems in without groups" do
build_repo4 do
build_gem "uninstallable", "2.0" do |s|
Expand Down
4 changes: 2 additions & 2 deletions spec/bundler/commands/update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1571,12 +1571,12 @@
end

it "does not claim to update to Bundler version to a wrong version when cached gems are present" do
pristine_system_gems "bundler-2.99.0"
pristine_system_gems "bundler-4.99.0"

build_repo4 do
build_gem "myrack", "3.0.9.1"

build_bundler "2.99.0"
build_bundler "4.99.0"
end

gemfile <<~G
Expand Down
32 changes: 32 additions & 0 deletions spec/bundler/other/major_deprecation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,38 @@
end
end

context "bundle install with a lockfile including X64_MINGW_LEGACY platform" do
before do
gemfile <<~G
source "https://gem.repo1"
gem "rake"
G

lockfile <<~L
GEM
remote: https://rubygems.org/
specs:
rake (10.3.2)

PLATFORMS
ruby
x64-mingw32

DEPENDENCIES
rake

BUNDLED WITH
#{Bundler::VERSION}
L
end

it "raises a helpful error" do
bundle "install", raise_on_error: false

expect(err).to include("Found x64-mingw32 in lockfile, which is no longer supported as of Bundler 4.0.")
end
end

context "when Bundler.setup is run in a ruby script" do
before do
create_file "gems.rb", "source 'https://gem.repo1'"
Expand Down
4 changes: 2 additions & 2 deletions yjit/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2427,7 +2427,7 @@ impl<'a> JITState<'a> {
// SAFETY: allocated with Box above
unsafe { ptr::write(blockref, block) };

// Block is initialized now. Note that MaybeUnint<T> has the same layout as T.
// Block is initialized now. Note that MaybeUninit<T> has the same layout as T.
let blockref = NonNull::new(blockref as *mut Block).expect("no null from Box");

// Track all the assumptions the block makes as invariants
Expand Down Expand Up @@ -3797,7 +3797,7 @@ pub fn gen_branch_stub_hit_trampoline(ocb: &mut OutlinedCb) -> Option<CodePtr> {
let mut asm = Assembler::new_without_iseq();

// For `branch_stub_hit(branch_ptr, target_idx, ec)`,
// `branch_ptr` and `target_idx` is different for each stub,
// `branch_ptr` and `target_idx` are different for each stub,
// but the call and what's after is the same. This trampoline
// is the unchanging part.
// Since this trampoline is static, it allows code GC inside
Expand Down