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

Support bundler 2 #494

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
Draft
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
37 changes: 24 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ jobs:

strategy:
matrix:
java-version: [8, 15]
ruby-version: [jruby-9.2.18.0, jruby-head]
java-version: [8, 11, 15]
ruby-version: [jruby-9.3.7.0, jruby-head]
task: ['', integration]

fail-fast: false

steps:
- name: checkout
- name: Checkout warbler
uses: actions/checkout@v2
with:
path: warbler

- name: Set up java ${{ matrix.java-version }}
uses: actions/setup-java@v2
Expand All @@ -37,25 +39,34 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: 1.17.3
bundler: 2.3.20

- name: Install fixed rubygems version
run: gem update --system 2.7.11
if: matrix.ruby-version != 'jruby-head'

# rubygems 2.7.11 is not supported on Ruby 3.1.0 (jruby-head).
# The oldest version supported by this ruby is 3.2.3.
- name: Install fixed rubygems version
run: gem update --system 3.2.11 && gem install bundler:1.17.3
if: matrix.ruby-version == 'jruby-head'
run: gem update --system 3.3.20

- name: Install dependencies
run: bundle _1.17.3_ install --jobs=3 --retry=3
run: bundle _2.3.20_ install --jobs=3 --retry=3
working-directory: warbler

- name: Checkout jbundler
uses: actions/checkout@v2
with:
repository: deivid-rodriguez/jbundler
ref: add_rake_install
path: jbundler

- name: Install jbundler
run: |
bundle install --jobs=3 --retry=3
bundle exec rake install
working-directory: jbundler

- name: Run tests
run: bundle exec rake ${{ matrix.TASK }}
if: matrix.ruby-version != 'jruby-head'
working-directory: warbler

- name: Run tests
run: bundle exec rake ${{ matrix.TASK }} || exit 0
if: matrix.ruby-version == 'jruby-head'
working-directory: warbler
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ integration/**/*.iml
build.log
.ruby-version
.rspec_status
vendor
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ source "https://rubygems.org/"

gemspec

gem 'jbundler', git: 'https://github.com/mkristian/jbundler'

rubyzip_version = ENV['RUBYZIP_VERSION']
gem 'rubyzip', rubyzip_version if rubyzip_version && !rubyzip_version.empty?

group :development, :test do
gem 'rdoc', ['>= 3.10', '< 4.3'], :require => nil
end

gem "jar-dependencies", "0.4.1"
2 changes: 0 additions & 2 deletions lib/warbler/gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 0 additions & 15 deletions lib/warbler/templates/bundler.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
19 changes: 2 additions & 17 deletions lib/warbler/traits/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,6 @@ def add_bundler_gems; require 'bundler'

bundler_specs.each do |spec|
spec = to_spec(spec)
# Bundler HAX -- fixup bad #loaded_from attribute in fake
# bundler gemspec from bundler/source.rb
if spec.name == 'bundler'
full_gem_path = Pathname.new(spec.full_gem_path)
while ! full_gem_path.join('bundler.gemspec').exist?
full_gem_path = full_gem_path.dirname
# if at top of the path, meaning we cannot find bundler.gemspec, abort.
if full_gem_path.to_s =~ /^[\.\/]$/
warn("Unable to detect bundler spec under '#{spec.full_gem_path}'' and its sub-dirs")
exit
end
end

spec.loaded_from = full_gem_path.join('bundler.gemspec').to_s
spec.full_gem_path = full_gem_path.to_s
end

case spec.source
when ::Bundler::Source::Git
Expand Down Expand Up @@ -143,7 +127,8 @@ def bundler_specs
bundle_without = config.bundle_without.map { |s| s.to_sym }
definition = ::Bundler.definition
all = definition.specs.to_a
requested = definition.specs_for(definition.groups - bundle_without).to_a
dependencies = definition.dependencies_for(definition.groups - bundle_without)
requested = definition.send(:materialize, dependencies).to_a
excluded_git_specs = (all - requested).select { |spec| ::Bundler::Source::Git === spec.source }
excluded_git_specs.each { |spec| spec.groups << :warbler_excluded }
requested + excluded_git_specs
Expand Down
2 changes: 1 addition & 1 deletion spec/rails4_stub/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ DEPENDENCIES
rails-api (~> 0.4)

BUNDLED WITH
1.16.1
2.3.20
4 changes: 0 additions & 4 deletions spec/sample_bundler/.bundle/config

This file was deleted.

2 changes: 1 addition & 1 deletion spec/sample_bundler/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ DEPENDENCIES
rake (= 12.3.3)

BUNDLED WITH
1.11.2
2.3.20
27 changes: 0 additions & 27 deletions spec/sample_bundler/vendor/bundle/jruby/2.5.0/bin/rake

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Loading