These are chat archives for jruby-gradle/jruby-gradle-plugin

25th
Aug 2015
Christian Meier
@mkristian
Aug 25 2015 12:32
integrationTest classloader is just mixing the plugin classloader and all its transitive dependencies for the test itself, i.e. just mixing everything and not obeying the plugins setup at all
gradleTest work if I pick the installed plugin from mavenLocal() but does not work without mavenLocal and using %%VERSION%%
isolating the embedded jetty did not help in any ways getting some tests running. some errors as with the old implementation
R. Tyler Croy
@rtyler
Aug 25 2015 13:56
I would expect gradleTest to work, but there's some effort that has to go into setting up the repos for it properly
@mkristian perhaps embedding tomcat would be easier
rtyler @rtyler ducks
Schalk W. Cronjé
@ysb33r
Aug 25 2015 14:43
Ha, it would be easier if one could just replicate a repo locally with transitive dependencies and metadata - should really be in Gradle but it is not - that is why I had to write the ivyPot plugin.
Blane Dabney
@raelik
Aug 25 2015 14:59
so, since there isn't really anything proprietary in our gradle file, I'm just gonna put up a gist of it
I managed to solve one issue:
  jrubyJar {
    extendsFrom gems, runtime
  }
adding gems there ensured that they got included in the jar. defaultGems() used to do that, but it seems to have been deprecated, and defaults 'gems' doesn't appear to do the same thing
R. Tyler Croy
@rtyler
Aug 25 2015 15:03
I should add a note in the documentation about that "sharing gems between configurations"
since I see you have a spec task there too
Blane Dabney
@raelik
Aug 25 2015 15:03
right, in this case, I actually don't want those gems used by the spec task
or at least, it doesn't need them
R. Tyler Croy
@rtyler
Aug 25 2015 15:04
oh, well, then why not add those dependencies directly to the jrubyJar configuration?
Blane Dabney
@raelik
Aug 25 2015 15:04
because I did at one point have other tasks that did need them
I had to remove them because of that gradle issue I found
(the multi-byte character mangling problem)
R. Tyler Croy
@rtyler
Aug 25 2015 15:05
ah
Blane Dabney
@raelik
Aug 25 2015 15:06
so what exactly does defaults do?
Blane Dabney
@raelik
Aug 25 2015 15:11
anyway, in case there's a bit of confusion, that chunked_csv_writer is a java subproject, and its archive gets uploaded to lib/repo in the main project, where I've also stored the vertica client jar, since there isn't a maven or ivy repo for it anywhere and I don't want to maintain a repo just for these two things.
R. Tyler Croy
@rtyler
Aug 25 2015 15:32
@raelik sorry about that confusion around it, I should add a deprecation warning on that defaults() method and make it error when not called with MainClass
Blane Dabney
@raelik
Aug 25 2015 15:33
So the only real problem I'm having now has to do with jruby-mains and the Jars.lock file
If I use -jar, manually set JARS_HOME and -rjars/setup, with the Jars.lock file in my project root, I can manually run scripts. However, having the Jars.lock file there causes all my gradle tasks to fail with https://gist.github.com/raelik/ae53a3a8f1f33e9ec13e
R. Tyler Croy
@rtyler
Aug 25 2015 15:36
that's a better question for @mkristian to answer if he's around, the usage of a fat jar, without using jruby-mains as the main class is a behavior I'm not too confident I can help with
did you ever try the java -jar my.jar -S ./my/script thing?
Blane Dabney
@raelik
Aug 25 2015 15:36
yeah, that doesn't work at all
R. Tyler Croy
@rtyler
Aug 25 2015 15:36
heh, fair enough, what happened?
just didn't find the script?
Blane Dabney
@raelik
Aug 25 2015 15:37
no, the error is quite odd, lemme find it
SyntaxError: ./lib/jvsql:1: unknown regexp options - vql
JRuby::Commands../lib/jvsql
R. Tyler Croy
@rtyler
Aug 25 2015 15:40
o_O
just on a hunch can you run that with an absolute path to the script?
Blane Dabney
@raelik
Aug 25 2015 15:40
yeahhhh no idea, the first line of jvsql.rb is require 'rubygems'
NameError: uninitialized constant Users
(path is /Users/....)
it's like it's interpreting that as ruby code
R. Tyler Croy
@rtyler
Aug 25 2015 15:42
yeah
weird
Blane Dabney
@raelik
Aug 25 2015 15:44
apparently you can't put anything there except a single name
R. Tyler Croy
@rtyler
Aug 25 2015 15:44
so, here's what I'm thinking
I believe that your usecase is closely related to @ysb33r's desire for initScript library() which IMHO is not very well defined as a featureset right now
one of the things discussed on the mailing list recently was this very subject, insofar as what library jrubyjars really are suppsoed to be
Blane Dabney
@raelik
Aug 25 2015 15:45
well, it's handy for it to be a runnable jar that just runs jruby
that way I can have gradle manage my jruby versions
R. Tyler Croy
@rtyler
Aug 25 2015 15:46
well, the runnable() is intended more as a self-contained executable jar type thing
using a jar as a bucket of all dependencies to run some Ruby stuff is a slightly different beast IMO
Schalk W. Cronjé
@ysb33r
Aug 25 2015 15:47
My main use-case remains asciidoctorj, which we for 1.6.0 needs to convert to using the new way of building
Blane Dabney
@raelik
Aug 25 2015 15:47
It seemed to work perfectly well for it before the switch to jar-dependencies
and honestly, it works for this too, except that dropping Jars.lock into the project root completely breaks gradle
R. Tyler Croy
@rtyler
Aug 25 2015 15:48
heh, before switching to jar-dependencies what we were doing was just unzipping all the jar dependencies and stuffing their class files in the jar
Blane Dabney
@raelik
Aug 25 2015 15:48
right, and that's definitely an issue, heh
so I understand the need to switch
R. Tyler Croy
@rtyler
Aug 25 2015 15:50
@ysb33r the library() documentation here probably should be updated with details on how one should actually use a library jar
@ysb33r does the functionality currently meet the asciidoctorj needs?
perhaps @raelik's usecase is a third distinct need?
R. Tyler Croy
@rtyler
Aug 25 2015 15:55
or perhaps it's just a need for another type of jruby-main main lcass
Blane Dabney
@raelik
Aug 25 2015 15:56
This would work fine if jar-dependencies would use the Jars.lock that's in the jar file
R. Tyler Croy
@rtyler
Aug 25 2015 15:57
well, to make that work I believe the environment isn't being set up properly to where it won't search into the jar file
which likely means that it wouldn't load the jars from in there properly either
Blane Dabney
@raelik
Aug 25 2015 15:58
it does do that though
Schalk W. Cronjé
@ysb33r
Aug 25 2015 15:58
@rtyler Not usre if it needs his reqs, but it could. THe basic idea is that if you just want a JAR with some ruby stuff in it, that will be re-used by other JARs then that should be in the ball park
R. Tyler Croy
@rtyler
Aug 25 2015 15:59
@ysb33r should it embed jruby?
Schalk W. Cronjé
@ysb33r
Aug 25 2015 15:59
no
it will have it has a transitive dependency
it will only embed unpacked GEMs + class files + some resources
R. Tyler Croy
@rtyler
Aug 25 2015 16:00
okay, then I'm pretty sure it's not doing what it's supposed to right now :P
Abel on the mailing list might enjoy a clarification as well :P
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:01
I’ll have a look when I come around to work no the build process for asciidoctorj again
YEah, I guess I should. Abel might just be able to help test it for asciidoctorj too.
R. Tyler Croy
@rtyler
Aug 25 2015 16:01
heh
Blane Dabney
@raelik
Aug 25 2015 16:02
so I know what's causing my Jars.lock issue when I use -jar. It's my need to set -C to be able run my scripts external to the jar
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:02
@rtyler He sometimes contributes patches or tests to asciidoctor projects
R. Tyler Croy
@rtyler
Aug 25 2015 16:03
@raelik I'm not sure that org.jruby.Main knows to look properly into jar files like jruby-mains does
JRubyMain extends Main but I'm not sure how much the setup of the scripting container being different changes it
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:04
@rtyler My life is just hectic atm
unlike last year this time when I had a lot of time
R. Tyler Croy
@rtyler
Aug 25 2015 16:05
no pressure man, I think I know enough now about that use-case to help guide this in a constructive direction
rtyler @rtyler knows how it can be
R. Tyler Croy
@rtyler
Aug 25 2015 16:05
remember earlier this year when I was house-shopping? :P
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:07
ha!
@rtyler I am in early stages of country-shopping - looking to relocate within next two years
R. Tyler Croy
@rtyler
Aug 25 2015 16:08
zomg berlin
how'd you like Leipzig? that's also a smart, cheap, area to live
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:08
nope, not Germany - taxes are too high.
R. Tyler Croy
@rtyler
Aug 25 2015 16:08
true
mexico is nice and cheap
xD
just don't get kidnapped :(
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:09
will need to pay protection money to the local crime boss
R. Tyler Croy
@rtyler
Aug 25 2015 16:09
@ysb33r is south africa on the table again? or never returning?
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:10
@rtyler SA is always on the table, but not right now. Economy needs to improve again (current governing party will need to lose a lot of their power for that to happen).
R. Tyler Croy
@rtyler
Aug 25 2015 16:11
bummer
portugal?
JRubyConf Lisbon 2016
yesplz
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:11
@rtyler WIll be looking for somewhere with good bandwidth, good weather and outdoor life. So will also be looking to do more remote work
Christian Meier
@mkristian
Aug 25 2015 16:33
@ysb33r I have portugal in mind if I get the feeling I am just working for the taxes (in Germany)
R. Tyler Croy
@rtyler
Aug 25 2015 16:33
heh
@mkristian but think of all the good rotkohl and leberwurst!
Christian Meier
@mkristian
Aug 25 2015 16:34
@rtyler rotkohl maybe, leberwurst I will surely not miss :)
@raelik you can pass in JARS_LOCK as an absolute path. org.jruby.Main with jruby-9k will find the gems.
@rtyler btw the jruby-mains just adds a couple of ENV variables to the regular org.jruby.Main - there is no SCriptingContainer like it is with warbler
Blane Dabney
@raelik
Aug 25 2015 16:38
Ahhhh, that's probably what I need, since I really need to be able to set -C
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:38
@mkristian I know there is quite a bit of java/groovy work going on in north of Portugal.
R. Tyler Croy
@rtyler
Aug 25 2015 16:39
so we're all moving to portugal is that the plan?
Blane Dabney
@raelik
Aug 25 2015 16:39
Excellent, that works
Christian Meier
@mkristian
Aug 25 2015 16:39
if this becomes a plan - count me in :)
R. Tyler Croy
@rtyler
Aug 25 2015 16:39
"Hey honey, how was your day? So we're moving to Portugal now"
Schalk W. Cronjé
@ysb33r
Aug 25 2015 16:41
@rtyler not sure I can handle all the sardines
R. Tyler Croy
@rtyler
Aug 25 2015 16:42
they're still a very active part of the EU, they get a lot of exports from Germany
we can import rotkohl and leberwurst!
Christian Meier
@mkristian
Aug 25 2015 16:44
hey - germany is exporting TOO much, we need to reduce it and boycott german goods :)
R. Tyler Croy
@rtyler
Aug 25 2015 16:45
@mkristian I'm already boycotting Merkel's bullshit, does that count?
rtyler @rtyler ducks
Christian Meier
@mkristian
Aug 25 2015 16:47
@rtyler everything counts which helps to balance out the differences between european countries. just need to be careful what I say in public nowadays
@rtyler so I got frustrated with this embedded rubygems server.
after I got it nicely isolated I realized that clone of the classloader I built is just already messed up by gradle integration test setup
not sure what goes wrong with gradleTest but it does miss some classes to even work with the "in place" plugin
so far no tests - they just all fail
but all the tests work just fine via the command line :)
R. Tyler Croy
@rtyler
Aug 25 2015 16:59
o_O
do you want to push the instructions up to your branch for running the tests manually and perhaps I can reproduce?
damnit we're up to two pages of issues again
Christian Meier
@mkristian
Aug 25 2015 18:11
@rtyler https://gist.github.com/mkristian/2f8fa53e3cb552c428dc this is src/gradleTest/embedded-rubygems-server/build.gradle
which works if I first install the plugin locally
it works via the commandline as well via gradleTest
the integrationTest just is too far away from ever working - the classloader running the test has nothing to do with the classloader when running the plugin via CLI
rtyler @rtyler nosd
Blane Dabney
@raelik
Aug 25 2015 18:34
@mkristian Right, but if I try to use that class directly, that main method will never get called because it isn't main(String[] args)
it just calls the main method from org.jruby.Main
really, the org.jruby.mains.JarMain does what I want
Christian Meier
@mkristian
Aug 25 2015 18:36
ah - the static main wrapper is JArMain
Blane Dabney
@raelik
Aug 25 2015 18:37
I just needed to set JARS_LOCK to uri:classloader://Jars.lock
that way when I use -C to change pwd to my external files, it still knows to look in the jar for it
Christian Meier
@mkristian
Aug 25 2015 18:38
yes
Blane Dabney
@raelik
Aug 25 2015 18:38
works perfectly now
Christian Meier
@mkristian
Aug 25 2015 18:38
:)
R. Tyler Croy
@rtyler
Aug 25 2015 18:39
@raelik is there any way I can convince you to write a blog post or document what you've done and how?
it's neat and I'd like to make it easier in the future if we can
Christian Meier
@mkristian
Aug 25 2015 18:40
@raelik @rtyler maybe it is also a "bug" in jruby-mains - not sure though ?
Blane Dabney
@raelik
Aug 25 2015 18:44
@mkristian I dunno, I see what you're doing there, and it behaves properly
my use case is just a little atypical
I think most folks are running their jruby apps in some sort of app server
as opposed to just using puma directly like I am
Christian Meier
@mkristian
Aug 25 2015 18:46
the JARS_LOCK is looked up on current directory. but could be set explicitly.
Blane Dabney
@raelik
Aug 25 2015 18:47
right, and in most cases, it's going to be uri:classloader://
Christian Meier
@mkristian
Aug 25 2015 18:47
I think the tendency is going to use something like puma or torqubox4 directly without app-server
R. Tyler Croy
@rtyler
Aug 25 2015 18:47
that's at least the tendency at Lookout :P
Christian Meier
@mkristian
Aug 25 2015 18:48
and with heroku - if I understood it right
and if you look at torquebox4 it also can create runnable jars :)
Blane Dabney
@raelik
Aug 25 2015 18:48
If I was packaging my entire app into the jar, this would be a non-issue
having to set that env var was the only change I had to make
adding -rjars/setup and setting JARS_HOME were superfluous
Christian Meier
@mkristian
Aug 25 2015 18:52
so it was only the JARS_LOCK file not found
Blane Dabney
@raelik
Aug 25 2015 18:52
right, and apparently copying it to my project root causes problems with gradle
plus, I didn't really want to have to have it in my project root anyway
Christian Meier
@mkristian
Aug 25 2015 18:53
right - it is meant for the packed jar to tell jruby what jars to load (from within the jar file)
Blane Dabney
@raelik
Aug 25 2015 18:56
right, which is exactly what I want. This lets me have jruby-complete plus all of my dependencies in the jar file, and all of my actual project files live directly on the filesystem
R. Tyler Croy
@rtyler
Aug 25 2015 19:11
see, I kind of think that might be a reasonable third option for jrubyjar
Blane Dabney
@raelik
Aug 25 2015 19:14
So here's the basic steps I had to take: https://gist.github.com/raelik/0ab65004122f1963f1a5
R. Tyler Croy
@rtyler
Aug 25 2015 19:53
cool thanks @raelik
Abel Salgado Romero
@abelsromero
Aug 25 2015 19:58
Hi people
R. Tyler Croy
@rtyler
Aug 25 2015 19:58
ohai!
Abel Salgado Romero
@abelsromero
Aug 25 2015 19:58
Seems i was lucky and got you on time
R. Tyler Croy
@rtyler
Aug 25 2015 19:58
I forgot I can just refer to you by name in here @abelsromero, otherwise I would have referenced you directly in our library() discussion earlier
well, I'm about to start an hour long meeting :P
but yeah, at work :)
Abel Salgado Romero
@abelsromero
Aug 25 2015 19:59
nice work if you can skip to be here
R. Tyler Croy
@rtyler
Aug 25 2015 19:59
heh
Abel Salgado Romero
@abelsromero
Aug 25 2015 20:00
I just wanted to clarify the issue i posted
the jar I talk about is basically asciidoctorj
R. Tyler Croy
@rtyler
Aug 25 2015 20:01
@abelsromero relevant to your interests is #204
Abel Salgado Romero
@abelsromero
Aug 25 2015 20:04
so it seems it is a bug
but still jruby-complete gets embedded inside the jar right?
We had our own discussion here (asciidoctor/asciidoctorj#375), and the basic idea is to make clear our case, to see if it makes sense be a feature in your plugin.
Schalk W. Cronjé
@ysb33r
Aug 25 2015 20:09
Hi @abelsromero
Abel Salgado Romero
@abelsromero
Aug 25 2015 20:09
hi
i was just reading the issue you opened, and seems exactly our case
Schalk W. Cronjé
@ysb33r
Aug 25 2015 20:11
@abelsromero are you already working on using the new jrubyJar for building asciidoctorJj?
Abel Salgado Romero
@abelsromero
Aug 25 2015 20:12
you mean a PR? nop
I'm far from your (plural and singular) expertise in gradle plugins
from what I saw jruby-complete is added a normal dependency and thus gets embedded, but I don't understand all the code
Schalk W. Cronjé
@ysb33r
Aug 25 2015 20:14
@abelsromero that is definitely a bug
Abel Salgado Romero
@abelsromero
Aug 25 2015 20:15
good to know, in the most absolute positive way :)
we just want to work together to improve both projects
thanks @ysb33r , I'll write a summary in our issue to inform the rest. Btw, enjoy Portugal
rtyler @rtyler comes back from his meeting
R. Tyler Croy
@rtyler
Aug 25 2015 21:10
@abelsromero so fixing #204 might solve your issues I presume?
R. Tyler Croy
@rtyler
Aug 25 2015 23:44
@raelik do you have a link to that gradle encoding issue you found?
wondering if I'm finding it as well