Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reintroduce bundler 2.4 #14995

Merged
merged 3 commits into from
Apr 12, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def assemblyDeps = [downloadAndInstallJRuby, assemble] + subprojects.collect {
it.tasks.findByName("assemble")
}

def bundlerVersion = "2.3.18"
def bundlerVersion = "~> 2"

tasks.register("installBundler") {
dependsOn assemblyDeps
Expand Down
2 changes: 1 addition & 1 deletion lib/bootstrap/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def execute_bundler_with_retry(options)
begin
execute_bundler(options)
break
rescue ::Bundler::VersionConflict => e
rescue ::Bundler::SolveFailure => e
$stderr.puts("Plugin version conflict, aborting")
raise(e)
rescue ::Bundler::GemNotFound => e
Expand Down
4 changes: 4 additions & 0 deletions rakelib/plugins-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@
"default-plugins": true,
"skip-list": false
},
"logstash-input-cloudwatch": {
"default-plugins": false,
"skip-list": true
},
"logstash-output-cloudwatch": {
"default-plugins": false,
"skip-list": true
Expand Down
11 changes: 2 additions & 9 deletions rakelib/plugins_docs_dependencies.rake
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class PluginVersionWorking
end

def try_plugin(plugin, successful_dependencies)
Bundler::DepProxy.__clear!
builder = Bundler::Dsl.new
gemfile = LogStash::Gemfile.new(File.new(LogStash::Environment::GEMFILE_PATH, "r+")).load
gemfile.update(plugin)
Expand All @@ -136,6 +135,8 @@ class PluginVersionWorking
definition.resolve_remotely!
from = PLUGIN_METADATA.fetch(plugin, {}).fetch("default-plugins", false) ? :default : :missing
extract_versions(definition, successful_dependencies, from)
builder.instance_eval { @sources = [] }
builder.instance_eval { @dependencies = [] }
end

def extract_versions(definition, dependencies, from)
Expand Down Expand Up @@ -204,14 +205,6 @@ task :generate_plugins_version do
end
end
end
DepProxy.class_eval do
# Bundler caches it's dep-proxy objects (which contain Gem::Dependency objects) from all resolutions.
# The Hash itself continues to grow between dependency resolutions and hold up a lot of memory, to avoid
# the issue we expose a way of clear-ing the cached objects before each plugin resolution.
def self.__clear!
@proxies.clear
end
end

Fetcher::CompactIndex.class_eval do
alias_method :__bundle_worker, :bundle_worker
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/bootstrap/bundler_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@

context 'abort with an exception' do
it 'gem conflict' do
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::VersionConflict.new('conflict') }
expect { subject }.to raise_error(::Bundler::VersionConflict)
allow(::Bundler::CLI).to receive(:start).with(bundler_args) { raise ::Bundler::SolveFailure.new('conflict') }
expect { subject }.to raise_error(::Bundler::SolveFailure)
end

it 'gem is not found' do
Expand Down