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

1st
Apr 2015
R. Tyler Croy
@rtyler
Apr 01 2015 17:27
@ysb33r ping
I'm trying to understand the dependency cycle for my task
Schalk W. Cronjé
@ysb33r
Apr 01 2015 17:59
yo
R. Tyler Croy
@rtyler
Apr 01 2015 18:05
so you're aware of what I'm trying to do in #104; I'm thinking jrubyexec{} needs to be updated a bit
er, #102
I need the task not to resolve all the gem dependencies, but I do need the jruby-complete classath stuff
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:06
Witj JRUbyExec you can change the classpath by using the configuration keyword to use another configuration.
R. Tyler Croy
@rtyler
Apr 01 2015 18:07
not with project.jrubyexec {} unfortunately
so I guess that's what I need to fix as the root of this
how does one add attributes available inside a closure like the DSL does?
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:11
yes, with project.jrubyexec you are bound to the curretn jvm grade is running within, so there is less flexibility.
R. Tyler Croy
@rtyler
Apr 01 2015 18:11
so it looks like this is an issue because the classpath and config are derived not from the proxy object in this exec delegate
it's delegating to a javaexec still underneath
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:12
we can probably solve #102 in different way
R. Tyler Croy
@rtyler
Apr 01 2015 18:12
well, I've thrown away one entire approach
so I'm less receptive to trying a third now :P
gem build has to be invoked multiple times to support multiple files
that's the root cause of my exploration with jrubyexec {}
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:14
let met just get this straight
you want to use gems from an exisitng folde ron the system and they are already unpacked, right?
R. Tyler Croy
@rtyler
Apr 01 2015 18:16
negative, I need to build a gem in such a way that I can let the existing gem install machinery pick it up and use it
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:16
do you want to build gem from grade? (that’s not what #102 is saying)
R. Tyler Croy
@rtyler
Apr 01 2015 18:17
in order to support that functionality, i have to build the gem
since a gem's directory structure as source is very different than what an 'installed' gem looks like
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:18
allow me to ask some more questions first
R. Tyler Croy
@rtyler
Apr 01 2015 18:18
shoot
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:19
what is it that #102 wants achieve in terms of functionality (not implementation)?
because with bundler AFAIK you can supply a gemspec and it will install all of those GEMs for you
R. Tyler Croy
@rtyler
Apr 01 2015 18:20
functional equivalence with bundler's gem 'foo', :path => '~/source/github/gems/foo' syntax, which allows for easier local development
@ysb33r using bundler with jruby-gradle would be madness :)
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:22
Agreed with 2nd point.
so for gem 'foo', :path => '~/source/github/gems/foo’, does that mean you are installing into gems/foo
R. Tyler Croy
@rtyler
Apr 01 2015 18:23
negative, in bundler that means the gem source code is sourced from that place
bu tbecause they're not actually building and using the gem from that source tree, it also actually gives you a runtime requirement of needing bundler to execute in order to run your code
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:25
now for the dumb question
You need to run some kind of (j)ruby build process on foo dir and have that end up in your gems directory?
R. Tyler Croy
@rtyler
Apr 01 2015 18:27
in build/? yes
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:29
yes in build/gems
R. Tyler Croy
@rtyler
Apr 01 2015 18:29
I'm basically trying to inject a build-time generated file into the dependency graph
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:31
that is not too difficult once you have it built, but I think you are hampering yourself by by trying to use project.jrubyexec.
R. Tyler Croy
@rtyler
Apr 01 2015 18:31
I'm not sure I've got another good option
I created a JRubyExec type task and set inputs and outputs dynamically, and that works, but only if you only ever use gemspec() once, since I can't invoke gem build with multiple gemspecs
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:32
It might be better to use code directly from JRubyExecDelegate
then you can control the build in a separate JVM
R. Tyler Croy
@rtyler
Apr 01 2015 18:34
is that something you think because jrubyexec{} needs cleaning up, or because this is the right issue
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:35
I think jrubyexec needs to remain as it is
I think the problem you want to solve is more than this
I would rather start with a copy-paste of jrubyexec and hack that to work the correct way.
If I look at it from a user point of view if I say gemspec (‘/path/to/gem.spec’) it tells me that I want to use the gem from this directory. (Then Gradle underneathh will grant b=my wish by building the GEM and placing it in the jruby.installDir
therefore every gemspec() will create a task internally to build each of those by using whatever the jruby version is that you have set in ruby{} configuration.
rtyler @rtyler nods
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:40
Those tasks can be chained into the appropriate configuration - I just need to check how to do it
You should thus be able to create a JRubyExec for each gemspec call during the configuration phase.
R. Tyler Croy
@rtyler
Apr 01 2015 18:43
hrmm, so you'd think instead of this approach I'm going in with one builder task for all the gemspecs to create a dynamic task for each?
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:43
that is my feeling atm
rtyler @rtyler nods
Schalk W. Cronjé
@ysb33r
Apr 01 2015 18:50
gemspec() also needs to return an instance of a org.gradle.api.artifacts.Dependency
R. Tyler Croy
@rtyler
Apr 01 2015 18:53
nope
well, FileCollection
that works too, a SelfResolvingDependency
R. Tyler Croy
@rtyler
Apr 01 2015 18:58
er
sorry, got distracted
my first approach was to try to use a SelfResolvingDependency and that failed miserably
I'll start generating dynamic tasks
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:12
sorry getting distracted by some pancakes
R. Tyler Croy
@rtyler
Apr 01 2015 19:23
PANCAKES!
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:28
yip!
right, for something in the dependencies block there are usually two/three parts 1 a configuration name 2 a string / map / or a function call return a Dependency instance [3] optional closure
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:38
So you’ll probably still need a SelfResolvingDependency, but you can implement getBuildDependencies to return the list of JRubyExec tasks that you have created
not sure about resolve() call though - need to think about that - I need to have a quick look at an example
R. Tyler Croy
@rtyler
Apr 01 2015 19:39
I think you might be overestimating what's needed here
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:39
hahaha
R. Tyler Croy
@rtyler
Apr 01 2015 19:39
there's a helper function files().builtBy(taskname)
which I've used in the dumb version of this, which does work and do what I expect
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:45
BTW how do you actually build the GEM? Rake?
R. Tyler Croy
@rtyler
Apr 01 2015 19:46
normally I use the rake tasks the bundler gem has
which effectively just call gem build my.gemspec
R. Tyler Croy
@rtyler
Apr 01 2015 19:54
yeah, this works, YAY
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:54
great
rtyler @rtyler cleans up the bullshit
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:55
PR coming soon then?
R. Tyler Croy
@rtyler
Apr 01 2015 19:55
what's kind of frustrating about gemspec files is that you need to execute gem build with the current working directory of the file
yeah
probably within the next 30
rtyler @rtyler refactors the shit out of this code
Schalk W. Cronjé
@ysb33r
Apr 01 2015 19:56
so you need to set workingDir on the JRubyExec task?
rtyler @rtyler nods
Schalk W. Cronjé
@ysb33r
Apr 01 2015 20:02
good stuff. I wish I can get time to finish that gradle-rake prototype of mine.
R. Tyler Croy
@rtyler
Apr 01 2015 20:03
we're banking harder and harder on gradle
all the build and release tooling I need to support starts with gradle
R. Tyler Croy
@rtyler
Apr 01 2015 20:37
damnit, with gem build I can't determine ahead of time what the file is going to be
and I can't tell it what filename to output
that's stupid
Schalk W. Cronjé
@ysb33r
Apr 01 2015 20:38
pretty much
rtyler @rtyler ponders
R. Tyler Croy
@rtyler
Apr 01 2015 20:39
I suppose I can capture the stdout and parse it
rtyler @rtyler gags
Schalk W. Cronjé
@ysb33r
Apr 01 2015 20:39
does this affect you from resolve()
how does gem build eventually dtermine the file name?
R. Tyler Croy
@rtyler
Apr 01 2015 20:40
parsing the contents and evaluating it as ruby
but yeah, the resolve() stuff works just file with how stuff is being returned
Schalk W. Cronjé
@ysb33r
Apr 01 2015 20:41
parsing the gemspec ?
R. Tyler Croy
@rtyler
Apr 01 2015 20:44
gemspec is juts a Ruby file
so in order to know what file to output, the gem command has to execute it
Schalk W. Cronjé
@ysb33r
Apr 01 2015 20:50
thus, and its now far beyond trivial, I was thinking whether it is possible to load up a jrubyRuntime instance and then evaluate gem inside it, without building it.
Similar to what I have don for th Rake prototype
ysb33r @ysb33r is just thinking aloud
R. Tyler Croy
@rtyler
Apr 01 2015 20:50
heh
parsing stdout ftw
Schalk W. Cronjé
@ysb33r
Apr 01 2015 20:51
that might be the quickest solution for now
R. Tyler Croy
@rtyler
Apr 01 2015 20:55
actually, shit
I can't parse stdout
unless I can update the outputs on a task after it's executed
Schalk W. Cronjé
@ysb33r
Apr 01 2015 21:04
especially not with gradle 2.x
R. Tyler Croy
@rtyler
Apr 01 2015 22:06
gargh
damnit
this is frustrating