Calling execute() on a task is something we don't really recommend. I think 
instead you should use task dependencies. Then you can simply use the standard 
lifecycle tasks such as 'gradle assemble', and your source is compiled twice, 
as needed.

Here's an example:

In your root build script (not in the body of a task):

allprojects {
     task recompileJava(type: Compile) {
         dependsOn compileJava
         source = compileJava.source
         classpath = compileJava.classpath
         ....
     }
     classes dependsOn recompileJava

I'm writing a standalone plugin, but hopefully the same can be achieved there as well. The sequence should be compile, format, recompile. I will try that. Thanks.

There is no way around the manual copying of the task properties? I would want to avoid such kind of coupling when possible. It might easily break in the future. Some reflection trickery could probably help to circumvent, but I was hoping there is a more high-level way to copy things over.

Cheers,

Marco

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to