mkristian / jar-dependencies

manage jar dependencies for ruby gems
MIT License
34 stars 19 forks source link

latest jar-dependencies changing behavior for non java platform gems #22

Closed kares closed 9 years ago

kares commented 9 years ago

this is not really a bug, more of a discussion around 9344905de98aa

... think we discussed some of this at https://github.com/jruby/jruby/commit/6a4cca9d6587638d863f04e68ea0ae9e0535c13a

historically jruby specific gems where not marked with -java platform.

not sure whether it's followed that much these days ... hopefully it is more than less, as it had issues from time to time ... (face-lift) what is the latest jruby-openssl version you're seeing https://rubygems.org/search?utf8=%E2%9C%93&query=jruby-openssl :)

back to history, AR-JDBC is released without the platform declaration ... I've used a "hack" to get the native extension build - pulling in javac compile dependencies using jar-dependencies ... now this no longer works with latest release (due 9344905de98aa) :

jar dependencies found on non-java platform gem - do not install jars

so I will probably introduce the platform declaration unless I get complains (this is for a new major-ish release anyway) ... but I wanted to understand your thinking/reasoning behind the change, thanks!

mkristian commented 9 years ago

the reason is solely on the server side of things, there is the http://rubygems-proxy.torquebox.org/release which is maven repo offering pom.xml for rubygems.

I hope soon (it depends on the torquebox server being able to run java-1.7 which is not the case right now) the torquebox server will use https://github.com/torquebox/rubygems-servlets and then you have the following behaviour:

to convert the gemspec to pom.xml for a ruby-platform-gem it is enough to use: rubygems.org/quick/Marshal.4.8/rake-10.4.2.gemspec.rz BUT those gemspecs are not complete and they do not carry the requirements list which has the info for the jar-dependencies. for gemspec with jar-dependencies I need to get the complete gem and extract the gemspec from this gem to create the pom.xml. the platform info a given gem + version can be retrieved from http://rubygems.org/specs.4.8.gz

maven needs for a version range all pom.xml where its version is inside the version range. if someone declares gem rake which translates to maven versions range of [0,) - maven will download all pom.xml for the rubygems:rake artifact. the torquebox proxy or any other proxy needs to download ALL available rake gemspec.rz files to create the pom.xml. when the proxy wants to obey the jar dependencies it needs to download ALL available gems instead. which can result in huge download on empty proxy cache.

currently the torquebox has already a few broken pom.xml or outdated pom.xml in its cache. but clearing the cache is done in the recent past on demand not a complete wipe out.

the idea to couple the gems with jar dependencies with the platform java is to reduce the need to download ALL gems to those java-platform gems and stay reasonable with all other platforms (basically ruby platform) and use those quick/Marshal.4.8/*gemspec.rz files

I have not asked to update the torquebox proxy yet but after I an update all rubygems.org-to-maven-repo proxies (rubygems-servlets, nexus from sonaytype) will not see the jar dependencies unless the gem is a java-platform gem.

so the change to jar-dependencies was to show the user early that the gem will not work - probably this is true only in cases where you use the maven repo like with jruby-maven-plugin or jruby-gradle-plugin.

maybe there is a rubygems.org api which I am not aware of which could provide the complete gemspec info. maybe you see somethings else ;)

mkristian commented 9 years ago

one more thing came up: there is the idea to implement some support in gradle to resolve gem artifacts using the api from rubygems.org - even here the problem is that jar dependencies would need to download the complete gem to the info. some as the proxy I mentioned above.

kares commented 9 years ago

thanks for the explanation, I get the big picture now - very useful hints ...

mkristian commented 9 years ago

just wanted to file the same issue: https://github.com/rubygems/rubygems.org/issues/954 :)