dry-rb / dry-container

A simple, configurable object container implemented in Ruby
https://dry-rb.org/gems/dry-container
MIT License
335 stars 41 forks source link

Cannot install 0.8.0 in JRuby #78

Closed katafrakt closed 3 years ago

katafrakt commented 3 years ago

Describe the bug

When attempting to install dry-container 0.8.0 on JRuby, I'm consistently getting an error:

ERROR:  Error installing dry-container:
    dry-container-0.8.0 requires Ruby version >= 2.6.0. The current ruby version is 2.5.7.0.

dry-core, which has similar code in the gemspec, installs fine.

To Reproduce

  1. Install JRuby
  2. Try to install dry-container with jruby -S gem install dry-container --version 0.8.0

Expected behavior

dry-container 0.8.0 is installed

My environment

I checked it with JRuby versions 9.2.16.0 and 9.2.17.0 on Linux and Mac. Tried gem update --system but did not help.

The only thing I see is that in dry-container rubygems page required ruby version on the right is >= 2.6.0 while with dry-core it says >= 2.5.0. So maybe a wrong file was pushed to RubyGems somehow?

solnic commented 3 years ago

@katafrakt our spec suite passes so this is confusing. Are you sure you're using the latest version of jruby?

katafrakt commented 3 years ago

@solnic yes, I am sure. Also, the test suite passes for me too when I clone the repo. It works when I set source to the git repo via

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'dry-container', git: 'https://github.com/dry-rb/dry-container'
end

but not for 0.8.0 (with bundler or without)

As for my JRuby version:

❯ ruby -v
jruby 9.2.17.0 (2.5.8) 2021-03-29 84d363da97 OpenJDK 64-Bit Server VM 25.282-b00 on 1.8.0_282-bre_2021_01_20_16_37-b00 +jit [darwin-x86_64]
katafrakt commented 3 years ago

I downloaded the actual files from rubygems and looked at metadata files. For dry-core it says:

required_ruby_version: !ruby/object:Gem::Requirement
  requirements:
  - - ">="
    - !ruby/object:Gem::Version
      version: 2.5.0

while for dry-container the relevant lines say

required_ruby_version: !ruby/object:Gem::Requirement
  requirements:
  - - ">="
    - !ruby/object:Gem::Version
      version: 2.6.0

So yeah, I suspect the problem does not lie in the code but in the file that has been pushed to rubygems.

solnic commented 3 years ago

@katafrakt 2.5.0 support was dropped in dry-container 0.8.0 but there's a workaround in the gemspec that is meant to make things work under jruby https://github.com/dry-rb/dry-container/blob/master/dry-container.gemspec#L29-L33

it turned out this doesn't work for some reason where the metadata is fetched via rubygems index :(

katafrakt commented 3 years ago

@solnic but I see the same workaround in dry-core, where it works 🤔

flash-gordon commented 3 years ago

@katafrakt nah, dry-core 0.6 has a different gemspec https://github.com/dry-rb/dry-core/blob/v0.6.0/dry-core.gemspec#L29

katafrakt commented 3 years ago

right, I was looking at master.

BTW I ran gem build dry-container.gemspec from JRuby and it generated "correct" metadata, but that's quite inconvenient.

flash-gordon commented 3 years ago

Yeah, it wasn't the goal. You can stick to the previous version of fry-container for the time being. There were no changes in the gem other than metadata update.

flash-gordon commented 3 years ago

I removed a condition for jruby so dry-container 0.8 is officially 2.6+ meaning it's not jruby-compatible. I did it because as I understand the matters jruby 9.3 is around the corner, so to speak. Once a preview is out I'll re-add it to CI. My hope is the problem will "resolve itself" soon, it's not a break up with jruby :) It's just reducing the maintaining effort. For the time being, it's safe to use older dry-* dependencies, we don't rush into adding lots of stuff at the moment :)

katafrakt commented 3 years ago

Ok, that's fair I guess. I'm not sure how close is the corner around which JRuby 9.3 hides, because there's still a number of unresolved issues, but let's hope it is close. I think this issue can be closed now.

flash-gordon commented 3 years ago

@katafrakt 👍 I think you can ping jruby folks for a brief update. I'm pretty sure it'd be fine to cut a new version without full 2.6 compat, at least as a preview. IIRC they used to do it in the past

katafrakt commented 3 years ago

Hey, @flash-gordon! JRuby 9.3.0.0 has been released, so I guess it's safe to re-add it (re this commit: https://github.com/dry-rb/template-gem/commit/6dec27f6c83051de750171d9adbca500b6fe8d05). Let me know if you want me to test some things first.

flash-gordon commented 3 years ago

@katafrakt yeah, I saw, great news. Now waiting for https://github.com/ruby/setup-ruby/issues/220 😅

flash-gordon commented 3 years ago

@katafrakt done 🎉