Open klobuczek opened 3 years ago
Ok, I think I figured it out. You do not provide hutch-java, but have conditional gemspec:
if defined?(JRUBY_VERSION)
gem.platform = 'java'
gem.add_runtime_dependency 'march_hare', '>= 3.0.0'
else
gem.platform = Gem::Platform::RUBY
gem.add_runtime_dependency 'bunny', '>= 2.16', '< 3.0'
end
This condition is resolved at build time, not at install time. Consequently, you need to build and deploy the gem for both platforms ruby and java.
An alternative would be to not require bunny
or march_hare
and leave it to the user to include those, but since you have as well conditional code the former approach would be nicer.
@michaelklishin could we tackle this to avoid bunny
being pulled in on jruby. I can provide a PR but need from you a decision on how you want to handle this. Keep deploying separate jruby versions or remove both bunny and march_hare dependencies from the gem. Using the gem from source works because the gemspec is available, but there is no gemspec in deployed gems and hence the platform condition has been resolved to the platform on which the gem was built.
@klobuczek thank you for volunteering to provide a PR.
What do you mean by "keep deploying separate JRuby versions", that we would push the gem twice on two platforms? That'd be OK with me. Not depending on any libraries sounds like a usability disaster given the existing install base and relative project maturity.
@michaelklishin sorry, I totally dropped this topic.
Yes, one way would be to deploy to rubygems a generic version that would depend on bunny
and a java-specific version depending on march_hare
.
Another way would be to provide march_hare
under the bunny
name for java platform. That way you would not need 2 platform-dependent hutch
versions, but would have 2 bunny flavors.
We have a similar problem with activegraph
and neo4j-ruby-driver
. We have chosen the latter and provided 2 completely different implementations under the same name neo4j-ruby-driver
but we made the api of both implementations identical, something that you achieve first with the adapters in hutch. So unless you move the adapters to bunny and march_hare probably the 1st option might be easier for you.
@michaelklishin
Could you deploy the -java version of the gem?
Simply run whatever you are doing usually e.g. rake release
but in a jruby context. It will push to rubygems a version with the -java
suffix.
On jruby-9.2.19.0
gem install hutch
installs bunny as dependency, but on loading complains about missingmarch_hare
: