ewhauser wrote:
> I've been working on a Gradle script for the last few days and have
> successfully: setup dependencies, call optional Ant tasks, use buildSrc,
> etc. However, there are a couple of things I could not figure out from the
> docs that would allow me to clean up my script a bit:
>
> 1. Can you invoke a task from inside another task programatically?
While it is possible to execute a task from another, I think you would have to
use an internal method to do so (AbstractTask.execute). I would not recommend
doing this.
Most of the time these needs can be met by factoring some of the body of a task
out into a shared groovy method (this is just a DSL on top of groovy after all),
or using task dependency.
> 2. How do you set a property from inside a task and retrieve it from another
> task? I tried using the DSL setProperty method, but it complained every
> time saying the property did not exist. I just used system properties as a
> temporary workaround.
task sometask << {
sometask.myprop = 'dynamic property'}
task anothertask << { println "from anothertask,
sometask.myprop=${sometask.myprop}" }
--
Steve Appling
Automated Logic Research Team
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email