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

16th
Oct 2014
Schalk W. Cronjé
@ysb33r
Oct 16 2014 04:05
mmm… not sure how we are going to get around #65. Not seeing anything in gem install help that will allow renaming / throw error
R. Tyler Croy
@rtyler
Oct 16 2014 04:06
I'll have to tinker with what happens if you take stdin away from gem install
I'm playing around with using jar to make redstorm work
how was dinner?
Schalk W. Cronjé
@ysb33r
Oct 16 2014 04:08
pretty good. Some good places around where we went to.
R. Tyler Croy
@rtyler
Oct 16 2014 04:14
turns out JRubyExec makes compilation doable with relative ease
Schalk W. Cronjé
@ysb33r
Oct 16 2014 04:14
Try passing standardInput=null in GemUtils where it does the install
R. Tyler Croy
@rtyler
Oct 16 2014 04:20
mind adding that to the ticket?
I'm in the middle of something else
R. Tyler Croy
@rtyler
Oct 16 2014 16:42
@ysb33r is there a pattern for code generation tasks in gradle i should follow for jruby=>java
Schalk W. Cronjé
@ysb33r
Oct 16 2014 16:43
What do you mean?
R. Tyler Croy
@rtyler
Oct 16 2014 16:46
For redstorn I'm generating a java file from a ruby file, then letting compileJava build it into the org
Schalk W. Cronjé
@ysb33r
Oct 16 2014 16:47
There is nothing published. Follow the pattern that I have done for code generation for the stub in jar
R. Tyler Croy
@rtyler
Oct 16 2014 16:48
aye aye cap'n
Schalk W. Cronjé
@ysb33r
Oct 16 2014 16:48

```=== Summary

You need to generate some code from a template, then add it to a source set to be compiled

=== Solution

Use a Copy task as a transformer, update sourceSets and create a dependency between the compilation

tasks and the generation tasks.

=== Examples

Let's assume this will be a Java project and the templates are in src/main/java-templates.
The generated output will go to $buildDir/generated/java.

[source,groovy]

task generateJava( type: Copy ) {
from('src/main/java-templates') {
include '*/.java.template'
}
into "${buildDir}/generated/java"

filter { String line ->

} <1>

rename '(.*)\.java\.template`, '$1.java' <2>
}

sourceSets.matching { it.name == "main" } .all {
it.java.srcDir new File(buildDir, 'generated/java')
}

compileJava.dependsOn generateJava

<1> Use a filter to transform the template file to the output source file on a line by line basis

Ugh. gitter doesn’t do asciidoc correctlt
anyhows that is a snippet on how it could be done
rtyler @rtyler nods
R. Tyler Croy
@rtyler
Oct 16 2014 17:58
looks reasonable