[rubygems/rubygems] Remove extension building sync stuff no longer present in RubyGems

https://github.com/rubygems/rubygems/commit/59a85388b9
This commit is contained in:
David Rodríguez 2023-12-12 21:32:17 +01:00 committed by Hiroshi SHIBATA
parent 41095f4de0
commit d718654bb1
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2
4 changed files with 2 additions and 35 deletions

View File

@ -4,17 +4,12 @@ require "rubygems" unless defined?(Gem)
module Bundler
class RubygemsIntegration
if defined?(Gem::Ext::Builder::CHDIR_MONITOR)
EXT_LOCK = Gem::Ext::Builder::CHDIR_MONITOR
else
require "monitor"
require "monitor"
EXT_LOCK = Monitor.new
end
EXT_LOCK = Monitor.new
def initialize
@replaced_methods = {}
backport_ext_builder_monitor
end
def version
@ -479,25 +474,6 @@ module Bundler
end
end
def backport_ext_builder_monitor
# So we can avoid requiring "rubygems/ext" in its entirety
Gem.module_eval <<-RUBY, __FILE__, __LINE__ + 1
module Ext
end
RUBY
require "rubygems/ext/builder"
Gem::Ext::Builder.class_eval do
unless const_defined?(:CHDIR_MONITOR)
const_set(:CHDIR_MONITOR, EXT_LOCK)
end
remove_const(:CHDIR_MUTEX) if const_defined?(:CHDIR_MUTEX)
const_set(:CHDIR_MUTEX, const_get(:CHDIR_MONITOR))
end
end
def find_bundler(version)
find_name("bundler").find {|s| s.version.to_s == version }
end

View File

@ -6,7 +6,6 @@ RSpec.describe Bundler::Plugin::Installer do
describe "cli install" do
it "uses Gem.sources when non of the source is provided" do
sources = double(:sources)
Bundler.settings # initialize it before we have to touch rubygems.ext_lock
allow(Gem).to receive(:sources) { sources }
allow(installer).to receive(:install_rubygems).

View File

@ -1,10 +1,6 @@
# frozen_string_literal: true
RSpec.describe Bundler::RubygemsIntegration do
it "uses the same chdir lock as rubygems" do
expect(Bundler.rubygems.ext_lock).to eq(Gem::Ext::Builder::CHDIR_MONITOR)
end
context "#validate" do
let(:spec) do
Gem::Specification.new do |s|

View File

@ -1,12 +1,8 @@
# frozen_string_literal: true
RSpec.describe Bundler::SharedHelpers do
let(:ext_lock_double) { double(:ext_lock) }
before do
pwd_stub
allow(Bundler.rubygems).to receive(:ext_lock).and_return(ext_lock_double)
allow(ext_lock_double).to receive(:synchronize) {|&block| block.call }
end
let(:pwd_stub) { allow(subject).to receive(:pwd).and_return(bundled_app) }