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

7th
Jul 2015
Blane Dabney
@raelik
Jul 07 2015 16:46
@rtyler So I figured out why I was having problems, I'm trying to use jruby 9.0.0.0.rc1
R. Tyler Croy
@rtyler
Jul 07 2015 16:53
and you found a bug in 9krc1 I hope?
R. Tyler Croy
@rtyler
Jul 07 2015 16:54
using 0.3.1 or 0..3.0?
Blane Dabney
@raelik
Jul 07 2015 16:54
0.3.1
R. Tyler Croy
@rtyler
Jul 07 2015 16:55
righto
please file that, I think we can probably fix and release 0.3.2 quickly
Blane Dabney
@raelik
Jul 07 2015 16:55
Will do
Blane Dabney
@raelik
Jul 07 2015 17:03
jruby-gradle/jruby-gradle-plugin#144
Schalk W. Cronjé
@ysb33r
Jul 07 2015 17:41
Oi, I thought we fixed that in prep for J9k.
R. Tyler Croy
@rtyler
Jul 07 2015 17:42
it may have just been a regression that we missed when @mkristian dropped lots of refactoring in
Christian Meier
@mkristian
Jul 07 2015 18:43
@ysb33r jrubyJarVersion works OK but jrubyJarVersionTriplet not
but how should I call the forth version number ?
R. Tyler Croy
@rtyler
Jul 07 2015 18:44
garbage?
just kidding xD
Christian Meier
@mkristian
Jul 07 2015 18:44
currently we have major.minor.patchlevel
R. Tyler Croy
@rtyler
Jul 07 2015 18:44
build?
Christian Meier
@mkristian
Jul 07 2015 18:44
good enough - thanx
but it is a string then ? since 9.0.0.0.rc2 give build '0.rc2'
well - it is not really meaningful :)
R. Tyler Croy
@rtyler
Jul 07 2015 18:46
what's the purpose of the map
Blane Dabney
@raelik
Jul 07 2015 18:47
surprised they did it that way, typically that's denoted with a dash, like -pre1, -rc1, -SNAPSHOT, etc
Christian Meier
@mkristian
Jul 07 2015 18:47
just searching for the usecase - can not find it anywhere
Schalk W. Cronjé
@ysb33r
Jul 07 2015 18:47
I have to look at the code to remember
Christian Meier
@mkristian
Jul 07 2015 18:47
@raelik that is the rubygems convention 9.0.0.0-rc2 is NOT rubygems version
Blane Dabney
@raelik
Jul 07 2015 18:47
right
Christian Meier
@mkristian
Jul 07 2015 18:48
how did you trigger this bug ?
Blane Dabney
@raelik
Jul 07 2015 18:48
defaultVersion '9.0.0.0.rc1'
R. Tyler Croy
@rtyler
Jul 07 2015 18:48
now that I think about it, I think i've seen that before and it might not be this
@raelik will you gist the output of the gradle command you're running with -S
Blane Dabney
@raelik
Jul 07 2015 18:52
Hmmm, it works with defaultVersion. setting execVersion is what caused it to break
Christian Meier
@mkristian
Jul 07 2015 18:52
I found where is get used :)
I just omit anything beyond the three digits - that is good enough for our usecase
Dunno why I set execVersion the first time, I'd changed it to defaultVersion since and it works fine.
Christian Meier
@mkristian
Jul 07 2015 18:54
thanx
Schalk W. Cronjé
@ysb33r
Jul 07 2015 18:55
@mkristian are you going to fix it?
Christian Meier
@mkristian
Jul 07 2015 18:56
yes - I am about to do so. @rtyler whats to have a new release with jruby-1.7.21 as default. so we figured this is small fix to be included
Blane Dabney
@raelik
Jul 07 2015 18:57
So, now that that's handled, I've got a question about configuring Gradle for a plain Rack app running through Puma on JRuby
Schalk W. Cronjé
@ysb33r
Jul 07 2015 18:57
This message was deleted
Blane Dabney
@raelik
Jul 07 2015 18:58
Currently, this app is managed with bundler, but we're looking at replacing that with gradle and the jruby-gradle-plugin, to consolidate the gem and external jar dependency management
Christian Meier
@mkristian
Jul 07 2015 18:59
welcome :)
@ysb33r just a quick look: jruby-gradle/jruby-gradle-plugin#145
Blane Dabney
@raelik
Jul 07 2015 19:00
what I'm not really getting is how to actually have it pull all of the gems and jars into a single place for deployment
here's my current build.gradle
I've imported JRubyPrepareGems here in preparation for making my own task to do exactly what I'm wanting to do, but I figured I'd ask just in case I was reinventing the wheel
Schalk W. Cronjé
@ysb33r
Jul 07 2015 19:04
@mkristian I’ll have a look and merge it if good, maybe you can help @raelik out
Christian Meier
@mkristian
Jul 07 2015 19:04
replacing "runtime" with gems will bring in the jars into the jar file. or replaceing "runtime" with "jrubyExec" will to do the same for the exec tasks
Blane Dabney
@raelik
Jul 07 2015 19:05
So, I'm not looking to deploy this to a jar file
Christian Meier
@mkristian
Jul 07 2015 19:05
@raelik assumed you use jrubyJar task for this !
Blane Dabney
@raelik
Jul 07 2015 19:06
There's no app server that this runs in
Christian Meier
@mkristian
Jul 07 2015 19:06
@raelik now you probably know (I do not) how to jar this "runtime" between the two configurations "gems" and "jrubyExec"
Blane Dabney
@raelik
Jul 07 2015 19:06
When I said it was a plain rack app using puma running under jruby, that was literal
there's no app server involved, puma is effectively the app server
Christian Meier
@mkristian
Jul 07 2015 19:07
yes, jrubyJar takes the puma rack application and puts it into a jar
either with or without jruby-complete bundled into jar as well
Blane Dabney
@raelik
Jul 07 2015 19:08
I want to avoid doing that if at all possible
Christian Meier
@mkristian
Jul 07 2015 19:08
not to include jruby-complete ?
Blane Dabney
@raelik
Jul 07 2015 19:09
to not package the app up as a jar
Schalk W. Cronjé
@ysb33r
Jul 07 2015 19:09
@mkristian @raelik I think I have an answer here, assuming that you only want to get everything into a single location for deployment?
Christian Meier
@mkristian
Jul 07 2015 19:10
sorry - I do not see the "not"
Blane Dabney
@raelik
Jul 07 2015 19:10
there are external legacy dependencies that need the app's files to be present on the filesystem
@ysb33r right, I'm just looking to replace bundler essentially, not re-architect how the app is laid out on the server.
There's also a migration from MRI to JRuby happening alongside this
Schalk W. Cronjé
@ysb33r
Jul 07 2015 19:13
Will this do?
task deploy( type : Copy ) {
  into ‘/where/ever/your/target/dir/is’
  from configurations.runtime
  from jrubyPrepareGems.outputDir
  dependsOn jrubyPrepareGems
}
Christian Meier
@mkristian
Jul 07 2015 19:14
@raelik how do you "require" those jars ?
Blane Dabney
@raelik
Jul 07 2015 19:15
during development, literally with 'require'
but we'd like to just have them defined in the build file and pulled down during deployment, and not have static external jars checked into our repo
I'd planned on doing something like this:
This message was deleted
jar_cache = File.expand_path(File.dirname(__FILE__) + '/.jarcache/')
if File.exists?(jar_cache)
  # Under JRuby `require`ing a `.jar` file will result in it being added to the
  # classpath for easy importing
  Dir["#{jar_cache}/*.jar"].each { |j| require j }
end
@ysb33r that would work, except that none of the gems' dependencies end up in the outputDir
Those all end up in ~/.gradle/cache/modules-2/files-2.1/rubygems
R. Tyler Croy
@rtyler
Jul 07 2015 19:20
@raelik are you sure you don't work with me? I swear I've seen this code before :P
Blane Dabney
@raelik
Jul 07 2015 19:20
hahahahaha
Schalk W. Cronjé
@ysb33r
Jul 07 2015 19:21

@raelik Ah, you don’t want the unpacked GEMs. Then

  from configurations.gems

should work.

R. Tyler Croy
@rtyler
Jul 07 2015 19:22
@raelik did you base your work on my blog posts about a frankenwar or frankenjar? :)
this is very close to the behaviors I'm supporting with our service artifact plugin
ysb33r @ysb33r double checks
Blane Dabney
@raelik
Jul 07 2015 19:23
That code I pasted was copied from one of the wiki pages
Christian Meier
@mkristian
Jul 07 2015 19:23
@ysb33r @rtyler can I remove this project.configurations.create('jrubyEmbeds') as it is not used anywhere. but I leave it if so desired
?
Blane Dabney
@raelik
Jul 07 2015 19:26
@rtyler That does look somewhat like what I'm wanting to do, yes
R. Tyler Croy
@rtyler
Jul 07 2015 19:26
@mkristian IMO we can safely remove it
@raelik the docs I wrote is where I recognized that code from, hah
which were originally based on some code I had internally
it's been a windy road to present day :)
Blane Dabney
@raelik
Jul 07 2015 19:26
heh
Christian Meier
@mkristian
Jul 07 2015 19:27
for example moving runtime to jrubyExec will add those jars to jruby without any code on your side
Blane Dabney
@raelik
Jul 07 2015 19:27
ok
Christian Meier
@mkristian
Jul 07 2015 19:28
for the deployment things are less straight forward. so I asked how you require them. which is fine
Schalk W. Cronjé
@ysb33r
Jul 07 2015 19:28
@raelk Just tested it to be sure, it should work to copy everything (or you can try @rtyler ’s suggestion)
gtg
Blane Dabney
@raelik
Jul 07 2015 19:29
will that also grab the jars?
R. Tyler Croy
@rtyler
Jul 07 2015 19:30
perhaps I'm missing something here, but you're just trying to build a fat jar with java deps inside the artifact right?
Blane Dabney
@raelik
Jul 07 2015 19:30
No
Though if all of the deps were packaged as a fat jar, that wouldn't be bad
But, no, I'm not trying to build a jar at all.
The app has dependencies on external jars, that I would like to pull from maven central when I deploy it
mainly to avoid having them in my repository
R. Tyler Croy
@rtyler
Jul 07 2015 19:34
deploy being a local gradle task?
Blane Dabney
@raelik
Jul 07 2015 19:35
the app itself exists as flat files out on the production server. gradle would be run there by chef
it could also be run locally to pull down the proper dependencies when doing local development
I am quite literally trying to replace bundler.
As little about the app's deployment that I can change, the better
R. Tyler Croy
@rtyler
Jul 07 2015 19:36
yeah the copy task that @ysb33r alluded to above is likely your best bet if you're going for minimal invasiveness
I'm quite partial to the artifact approach (as is the rest of Lookout) because we have all the precise versions codified in the fat jar artifact for posterity
@raelik you should look at https://github.com/nebula-plugins/gradle-dependency-lock-plugin/ while you're poking about
if you're using Gemfile.lock, but beware that doesn't work with gradle 2.4
R. Tyler Croy
@rtyler
Jul 07 2015 19:45
@ysb33r @mkristian running the integration tests now with 1.7.21 defaulted then i"ll release 0.3.2
Christian Meier
@mkristian
Jul 07 2015 19:48
we also need to see that those tests are more reliable on travis - red can be so ugly on some days
R. Tyler Croy
@rtyler
Jul 07 2015 19:49
indeed
Christian Meier
@mkristian
Jul 07 2015 19:55
jcenter is live mirror on mavenCentral ? no caching ? no delay ?
R. Tyler Croy
@rtyler
Jul 07 2015 19:57
the liveness I'm not sure
I resolved the 1.7.21 release already through jcenter once to even start the build process though
Christian Meier
@mkristian
Jul 07 2015 19:57
ok
R. Tyler Croy
@rtyler
Jul 07 2015 19:58
you know, there might be just another place to update that string
Christian Meier
@mkristian
Jul 07 2015 19:58
yes there are a few places
or at least there were
R. Tyler Croy
@rtyler
Jul 07 2015 20:28
@mkristian ping
Christian Meier
@mkristian
Jul 07 2015 21:49
@rtyler pong
R. Tyler Croy
@rtyler
Jul 07 2015 21:50
@mkristian with the execution environment of a self-contained jar, the uri:classloader path is guaranteed to be in the $LOAD_PATH right?
Christian Meier
@mkristian
Jul 07 2015 21:54
with 9k it is always on the load_path for any jruby installation. let me check jruby-mains
R. Tyler Croy
@rtyler
Jul 07 2015 21:54
realizing that jruby-gradle-storm-plugin relies on that assumption
Christian Meier
@mkristian
Jul 07 2015 21:58
actually no it is not. the CWD is set to be uri:classloader:/ and any relative LOAD_PATH entry is relative to CWD
but no explicit entry. but it is still there in a way more implicit since jruby always looks at the classloader to find files