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

13th
May 2015
R. Tyler Croy
@rtyler
May 13 2015 15:29
@ysb33r have a chance to take a look at those three tickets yet?
R. Tyler Croy
@rtyler
May 13 2015 15:48
@mkristian want to take a look at jruby-gradle/jruby-gradle-jar-plugin#44 or should I just start on that?
Christian Meier
@mkristian
May 13 2015 15:50
I just read it. not surprised about the discussion from yesterday since I really add everything on top of this jar task.
R. Tyler Croy
@rtyler
May 13 2015 15:50
heh
rtyler @rtyler nods
Christian Meier
@mkristian
May 13 2015 15:51
maybe we should revert the commit and wait until we/I looked at the new issues from yesterday
R. Tyler Croy
@rtyler
May 13 2015 15:52
the commit isn't released
Christian Meier
@mkristian
May 13 2015 15:52
ok then we just move forward on master
R. Tyler Croy
@rtyler
May 13 2015 16:10
@headius could we move jruby-mains to the jruby org now?
@mkristian I did not set an initScript and I've got no jar-bootstrap.rb defined, yet the jar gets created and then when it executes it doesn't appear to do anything (no error, just starts and outputs nothing)
this is a bug in two places right?
Schalk W. Cronjé
@ysb33r
May 13 2015 16:17
I reckon there needs to be a check rhat initScript exists. Throw StopTaskExecuteException if it does not.
rtyler @rtyler files
R. Tyler Croy
@rtyler
May 13 2015 16:20
alright jruby-gradle/jruby-gradle-jar-plugin#45 created
Christian Meier
@mkristian
May 13 2015 16:20
@rtyler did set a defaultMain ? if yes, then the jar acts like jruby-complete.jar - no error just starts and outputs nothing ;)
R. Tyler Croy
@rtyler
May 13 2015 16:20
yes, defaultMain() is present
Christian Meier
@mkristian
May 13 2015 16:22
then this what you want. java -jar myapp.jar -S rake -T will work if it is an executable jar.
R. Tyler Croy
@rtyler
May 13 2015 16:23
I understand that behavior, but I'm not sure if that's the right expectation for a jar plugin user
rtyler @rtyler ponders
Christian Meier
@mkristian
May 13 2015 16:23
maybe my mindset is just way off the line ? I just never used any bootstrap.rb files - that feels really restrictive
R. Tyler Croy
@rtyler
May 13 2015 16:24
in my opnion if a user isn't telling the plugin what the entry point (their code) is for an executable jar, then it's likely in error
you, @ysb33r and I are the only people I know that are aware of the -S functionality on jruby-complete :P
Christian Meier
@mkristian
May 13 2015 16:25
so it is basically your application + jruby-complete and you can do the same things as with normal jruby and the application on the filesystem. like startup the server with java -jar myapp.jar -S rackup
R. Tyler Croy
@rtyler
May 13 2015 16:25
I'm thoroughly familiar with that functionality
Christian Meier
@mkristian
May 13 2015 16:26
well actually jruby has a feature which allows to skip the '-S' since bin of jar will searched on classpath
so if I stop the task execution without an bootstrap.rb script how do I create runnable jar which I can use in my way ?
R. Tyler Croy
@rtyler
May 13 2015 16:31
hrm
perhaps a better way to address this usability gap would be
if I invoke the .jar without -S and no jar-bootstrap.rb exists, that should error?
Christian Meier
@mkristian
May 13 2015 16:34
you mean without any arguments and no jar-bootstrap.rb - instead of doing nothing you get an error. yes, that makes sense.
R. Tyler Croy
@rtyler
May 13 2015 16:34
I would be satisfied with that as an alternative to #45, the combination of these two behaviors is really confusing
Schalk W. Cronjé
@ysb33r
May 13 2015 16:36
@mkristian it might be achieved by not defaulting initScript to a name, but rather to null, which could be one way. Alternatively the use of a keyword in the jruby block. I just think that both uses cazes is worthwhile supporting
Christian Meier
@mkristian
May 13 2015 16:36
maybe the error can tell can be descriptive about maybe missing a jar-bootstrap.rb or a missing script argument
@ysb33r either initScript or the keyword 'runnable' or an error
yes that will help the user
Schalk W. Cronjé
@ysb33r
May 13 2015 16:40
Maybe initScript runnable() where runnable returns a special enum rather than a string. Nicely expressive, yet pretty typesafe.
R. Tyler Croy
@rtyler
May 13 2015 16:41
I like that
Christian Meier
@mkristian
May 13 2015 16:42
and fail without if their is only initScript or only defaultMain, i.e. we always want both
?
R. Tyler Croy
@rtyler
May 13 2015 16:43
IMO defaultMain() should be there by default and not need to be expressed :P
Christian Meier
@mkristian
May 13 2015 16:43
ok
R. Tyler Croy
@rtyler
May 13 2015 16:44
hrm, I can't seem to get from or include with my jar to work now
rtyler @rtyler digs deeper
Schalk W. Cronjé
@ysb33r
May 13 2015 16:48
The purpose of defaultMain was originally to force the use to specify an entry class or use the one provided by the build process. IIRC we also did that because we used a task extension, which made it harder to push a default value - it had to do with way the jar task worked.
R. Tyler Croy
@rtyler
May 13 2015 16:49
perhaps jrubyJar should move from a Jar task to a task definition by itself?
Christian Meier
@mkristian
May 13 2015 16:50
I do not think we need the Jar task for jrubyJar
R. Tyler Croy
@rtyler
May 13 2015 16:52
huh?
jrubyJar is most certainly a Jar task from what I see
Schalk W. Cronjé
@ysb33r
May 13 2015 16:57
You could extend a Zip task, but you'll have to do all of the extra metInf stuff yourself. You could consider extending Jar task. You mivht need to add a task listener to hook in the beforeExecute action, if you need to do stuff just before Jar task's exec() kicks off.
Christian Meier
@mkristian
May 13 2015 16:59
yes, I had the Zip tasks in mind but right the METAINF needs to be done. but I will look into task listeners
Schalk W. Cronjé
@ysb33r
May 13 2015 17:01
I would suggest extending Jar instead. Just ask if you get stuck.
Christian Meier
@mkristian
May 13 2015 17:01
ok
Christian Meier
@mkristian
May 13 2015 17:08
back to the initScript: 1) initScript 'app.rb' 2) initScript runnable() 3) initScript null
R. Tyler Croy
@rtyler
May 13 2015 17:09
I like 1, 2, what's 3 for?
Christian Meier
@mkristian
May 13 2015 17:09
or do we just skip 3) ? or something else ? null would means you need to have jar-bootstrap.rb or META-INF/jar-bootstrap.rb in your sourceSets
basically following the old default META-INF/init.rb
R. Tyler Croy
@rtyler
May 13 2015 17:14
when you say initScript null would that just be a default behavior, or would that be something that a user would have do write?
Christian Meier
@mkristian
May 13 2015 17:16
let's come from jruby-mains. the main looks for jar-bootstrap.rb and META-INF/jar-bootstrap.rb if finds one of them, then it will be executed. otherwise it just pass the ARGV on to jruby-complete
if not 1) or 2) then we need to ensure that the jar has a jar-bootstrap.rb otherwise jruby-mains will execute jruby-complete without any ARGV which ends into this "doing nothing" loop
so I have the feeling no 3) then gradle can fail and tell the user what is missing
R. Tyler Croy
@rtyler
May 13 2015 17:40
I think that's reasonable
R. Tyler Croy
@rtyler
May 13 2015 18:22
I'll file another ticket for the definition of a proper JRubyJar task
R. Tyler Croy
@rtyler
May 13 2015 18:37
@ysb33r any objections to making @mkristian a contributor (merge/assign access) to the repos?
Christian Meier
@mkristian
May 13 2015 18:39
I really like having someone reviewing my PR and would like to keep the process regardless on my permissions on the repos
R. Tyler Croy
@rtyler
May 13 2015 18:39
I would too :)
I just want to assign tasks and have you be able to merge if everybthing looks good
@mkristian so I think without jruby-gradle/jruby-gradle-jar-plugin#46 and some of the others I'm going to stop working on what I'm working on
R. Tyler Croy
@rtyler
May 13 2015 18:44
since they're effectively blocking my adoption of the recent jruby-mains changes
Christian Meier
@mkristian
May 13 2015 18:48
reading jruby-gradle/jruby-gradle-jar-plugin#46 what is difference between from('special/dir') and sourceSets ?
R. Tyler Croy
@rtyler
May 13 2015 18:49
sourceSets I would expect to contain source code, but not something like configuration iles
Christian Meier
@mkristian
May 13 2015 18:51
this implies the ruby can not use Dir[ 'config/*yaml' ] to iterate over config files - or are yaml part of sourceSet then ? or does plugin just creates the .jrubydir files for all possible files associated with JRubyJarTask
?
R. Tyler Croy
@rtyler
May 13 2015 18:53
would config/ need a .jrubydir in the archive?
Christian Meier
@mkristian
May 13 2015 18:54
if the ruby code wants to use directory globs on the directory then yes.
R. Tyler Croy
@rtyler
May 13 2015 18:56
oh, yuck
I didn't realize that
hrm
Christian Meier
@mkristian
May 13 2015 18:57
I do not think this is problem. in the end I just need to go over all the files which go into jar before actually packing the jar. this was the idea I used for current code.
and there are cases where Dir globs work without .jrubydir BUT there are also cases where it does not work. I stubborn to get it works everywhere - can not help it ;)
R. Tyler Croy
@rtyler
May 13 2015 19:01
hrm
so perhaps what the JRubyFatJar task should do, under the covers so I don't have to care about it as a user, is create a staging direcotory in $buildDir like we were discussing yesterday when it packs the .jar
Christian Meier
@mkristian
May 13 2015 19:03
exactly
R. Tyler Croy
@rtyler
May 13 2015 19:04
@mkristian FWIW, as far as Lookout work goes, let's create JIRAs around these, and then this would be good to continnue thorugh the end of the week
this is required IMO for us to meet the jruby-mains deliverable
Christian Meier
@mkristian
May 13 2015 19:09
ok
Schalk W. Cronjé
@ysb33r
May 13 2015 19:26

reading jruby-gradle/jruby-gradle-jar-plugin#46 what is difference between from('special/dir') and sourceSets ?

A SourceSet is a special Gradle object meant to carry source code.

@ysb33r any objections to making @mkristian a contributor (merge/assign access) to the repos?

Good by me.

when you say initScript null would that just be a default behavior, or would that be something that a user would have do write?

I would prefer the user to not have to write that - it’s ugly

Null is just the defautl value for initScript. If we use the runnable() approach then we can thrown an exception if initScript is null at execution time.
Christian Meier
@mkristian
May 13 2015 19:30
ok - I think we are all on the same boat here