On 5/8/14, May 8, 12:31 PM, Johan Vos wrote:

We're getting closer to building the JavaFX Android runtime in OpenJFX.
I'm trying to automate all steps in the gradle build files, but my
knowledge is still very limited.
My current bottleneck: I would like to apply retrolambda to all class files
once they are compiled (per module). In my JavaFX Android application, this
is easily done by following the instructions for the retrolambda-gradle
plugin at https://github.com/evant/gradle-retrolambda. I just add apply
plugin: 'retrolambda' and automatically all my class files are converted
from Java 8 to Java 7, with lambda's being replaced.
For some reason, this doesn't work out of the box on the OpenJFX build --
maybe because it's a multiproject, or maybe because the jfxrt.jar is not
created with the jar command?

I currently do the following: unjar the jfxrt.jar after everything is
built, apply retrolambda on the class files, and repackage everything.
Clearly, this is a much dirtier than applying the retrolambda step after
compilation of the class files in each module.
   defineProperty("JAVAC", cygpath("$JDK_HOME/bin/javac${IS_WINDOWS ? '.exe' : 
In theory you could make javac be a shell script that would compile the classes 
then convert them with retolambda. Not sure how easy or hard that would be 
though, as there is certainly not a 1x1 map to the source files passed to the 
output classes.

Another likely candidate would be to perform a pass over the class files just 
before we create the jar. I was just in that code tinkering with the filter 
mechanism. This would be in:
    def jfxrtTask = task("jfxrt$t.capital", type: Jar) {
Not sure how much I like that though, changing all of the class files would 
mess with timestamps.

The last suggestion - and the one I like best is using the jar closure/action 
It might be possible/reasonable to call retrolambda on each of the class this 
way, hopefully as a filter so you don't touch the originals.

Based on a change I just sent out for review, I would try to define the 
action/closure in the platform property file and then conditionally apply it 
when present.

Here is the example from my review 


2777         if (targetProperties.containsKey('jfxrtJarExcludes')) {
2778             exclude(targetProperties.jfxrtJarExcludes)
2779         }

I think the result would be something like:

if (targetProperties.containsKey('jfxrtJarFilter')) {
Then the fun would be constructing the filter to "filter the contents of the 
file" using retrolambda


Is there someone with sufficient gradle knowledge who can help here?

I've watched a number of gradle tutorials, and while I'm more pleased with
gradle than with maven, the only thing that disturbs me is that
gradle-professionals claim that "gradle is extremely easy". Build tools are
NEVER easy for developers :) Some are just a bit easier than others.


- Johan

David Hill <david.h...@oracle.com>
Java Embedded Development

"The Internet: where men are men, women are men, and children are FBI agents."

  • Re: gradle David Hill

Reply via email to