From 7f3423d61da637179e28a5a61e608ee3d1305d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Mon, 8 Aug 2022 16:22:01 +0200 Subject: [PATCH 1/4] Remove no longer needed code --- lib/warbler/gems.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/warbler/gems.rb b/lib/warbler/gems.rb index 799c9cc7..b278442e 100644 --- a/lib/warbler/gems.rb +++ b/lib/warbler/gems.rb @@ -52,8 +52,6 @@ def specs(gem_dependencies) # Add a single gem to WEB-INF/gems def find_single_gem_files(gem_dependencies, gem_pattern, version = nil) gem_spec_class = Gem::Specification - gem_spec_class = Gem::BasicSpecification if Gem.const_defined?(:BasicSpecification) - # Gem::Specification < Gem::BasicSpecification (since RGs 2.1) case gem_pattern when gem_spec_class return BundlerHelper.to_spec(gem_pattern) From 1463d88b54b3e852c3209453be7dd3320fe90790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 8 Jun 2021 12:11:05 +0200 Subject: [PATCH 2/4] Fix error requiring `bundler/shared_helpers` Currently warbler is unusable from jruby 9.2 during to this require failing (not sure to which extent though, but at least one spec is failing and there's an open issue about this). If we stop monkeypatching bundler, we don't need to require it, and thus the error disappears. Since doing that doesn't make any tests fail, I will assume the problems caused by not monkeypatching bundler are less important than the problems caused by doing it. So, I'm removing the code to fix the issue and get specs green. --- lib/warbler/templates/bundler.erb | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lib/warbler/templates/bundler.erb b/lib/warbler/templates/bundler.erb index e171eae5..2f49dcc0 100644 --- a/lib/warbler/templates/bundler.erb +++ b/lib/warbler/templates/bundler.erb @@ -2,18 +2,3 @@ ENV['BUNDLE_WITHOUT'] = '<%= config.bundle_without.join(':') %>' <% if config.bundler[:frozen] -%> ENV['BUNDLE_FROZEN'] = '1' <% end -%> - -module Bundler - module Patch - def clean_load_path - # nothing to be done for embedded JRuby - end - end - module SharedHelpers - def included(bundler) - bundler.send :include, Patch - end - end -end - -require 'bundler/shared_helpers' From 8f3e2cccd1b4db37c122a2f6be4e37ce45a878d0 Mon Sep 17 00:00:00 2001 From: Chad Wilson <29788154+chadlwilson@users.noreply.github.com> Date: Thu, 9 Oct 2025 13:37:05 +0800 Subject: [PATCH 3/4] fix: Ensure Gem.paths are clear/reset after being adjusted during init --- lib/warbler/templates/jar.erb | 2 ++ lib/warbler/templates/war.erb | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/warbler/templates/jar.erb b/lib/warbler/templates/jar.erb index 5bc33849..43810e0f 100644 --- a/lib/warbler/templates/jar.erb +++ b/lib/warbler/templates/jar.erb @@ -9,3 +9,5 @@ ENV['GEM_PATH'] = nil # RGs sets Gem.paths.path = Gem.default_path + [ GEM_HOME <% if config.bundler && config.bundler[:gemfile_path] -%> ENV['BUNDLE_GEMFILE'] = File.expand_path(File.join('..', '..', '<%= config.bundler[:gemfile_path] %>'), __FILE__) <% end -%> +<%# Ensure any cached paths are cleared; otherwise behaviour can be indeterminate if the paths have already been read %> +# Gem.clear_paths diff --git a/lib/warbler/templates/war.erb b/lib/warbler/templates/war.erb index 6f141f6d..519ec4d1 100644 --- a/lib/warbler/templates/war.erb +++ b/lib/warbler/templates/war.erb @@ -1,10 +1,5 @@ if $servlet_context.nil? ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> File.expand_path(File.join('..', '..', '<%= config.gem_path %>'), __FILE__) -<% if config.override_gem_home -%> -<% # GEM_HOME/GEM_PATH are set as .war gets extracted (on java -jar ...) - # ... thus setting `ENV['GEM_PATH'] = nil` would cause a boot failure --%> -<% end -%> <% if config.bundler && config.bundler[:gemfile_path] -%> ENV['BUNDLE_GEMFILE'] ||= File.expand_path(File.join('..', '..', '<%= config.bundler[:gemfile_path] %>'), __FILE__) <% end -%> @@ -17,3 +12,5 @@ else ENV['BUNDLE_GEMFILE'] ||= $servlet_context.getRealPath('/<%= config.bundler[:gemfile_path] %>') <% end -%> end +<%# Ensure any cached paths are cleared; otherwise behaviour can be indeterminate if the paths have already been read %> +Gem.clear_paths From 77afa0685d765ad419fb908dc92ed2e60bde7c74 Mon Sep 17 00:00:00 2001 From: Chad Wilson <29788154+chadlwilson@users.noreply.github.com> Date: Fri, 10 Oct 2025 01:49:30 +0800 Subject: [PATCH 4/4] test: Fix specs for jruby 9.4.14.0 The default platform name was changed from 1.8 -> 8 --- spec/rails7_stub/Gemfile.lock | 1 + spec/sample_bundler/Gemfile.lock | 1 + 2 files changed, 2 insertions(+) diff --git a/spec/rails7_stub/Gemfile.lock b/spec/rails7_stub/Gemfile.lock index 490e8105..2bdf71ec 100644 --- a/spec/rails7_stub/Gemfile.lock +++ b/spec/rails7_stub/Gemfile.lock @@ -190,6 +190,7 @@ GEM PLATFORMS universal-java-1.8 universal-java-21 + universal-java-8 DEPENDENCIES activerecord-jdbcpostgresql-adapter (~> 70.0) diff --git a/spec/sample_bundler/Gemfile.lock b/spec/sample_bundler/Gemfile.lock index 3c484132..bff10a88 100644 --- a/spec/sample_bundler/Gemfile.lock +++ b/spec/sample_bundler/Gemfile.lock @@ -6,6 +6,7 @@ GEM PLATFORMS universal-java-1.8 universal-java-21 + universal-java-8 DEPENDENCIES rake (= 13.3.0)