Sorry, I misread your first email. I wish I knew the answer to that but unfortunately I do not. I would say that faced with a similar problem at work we opted instead to just make the "closure-less" task a simple groovy function as our problem was solvable by a one line groovy script.
Regards, James On Mon, Apr 25, 2011 at 7:03 PM, Ali, Haneef <[email protected]> wrote: > Thanks for the example. That works, but how about the task which doesn't have > action closure. That's where I'm stuck > > > E.g > task myTar (type : Tar){ > from("fromdir") > destination(buildDir) > baseName = "myRportstar" > } > > > Since this task doesn't have user defined action closure, nothing is getting > executed when I do tasks.myTar.execute(); > > > Thanks, > Haneef > > -----Original Message----- > From: James Carr [mailto:[email protected]] > Sent: Monday, April 25, 2011 3:41 PM > To: [email protected] > Subject: Re: [gradle-user] How to call a task from another task > > Yep... > > task hello << { > print "Hello" > } > > task world << { > print "World!" > } > > world.doFirst { > tasks.hello.execute() > print " " > } > > > Hope that helps. > > Thanks, > James > > > On Mon, Apr 25, 2011 at 5:35 PM, James Carr <[email protected]> wrote: >> I'll have to check, but off the top of my head I think you can do >> tasks[taskName].execute() >> >> Thanks, >> James >> >> On Mon, Apr 25, 2011 at 5:09 PM, Ali, Haneef <[email protected]> wrote: >>> If the test fails , then test.doLast is never called. Assuming doLast is >>> called, still I don't understand how to call another task from doLast or >>> from anywhere else. >>> >>> >>> Also if a task has both config closure and action closure, how will you >>> define and call it >>> >>> >>> Thanks, >>> Haneef >>> >>> >>> >>> -----Original Message----- >>> From: Ken Sipe [mailto:[email protected]] >>> Sent: Monday, April 25, 2011 12:00 PM >>> To: [email protected] >>> Subject: Re: [gradle-user] How to call a task from another task >>> >>> why wouldn't you do a test.doLast() ? >>> >>> Ken Sipe | [email protected] | blog: http://kensipe.blogspot.com >>> >>> >>> >>> On Apr 25, 2011, at 12:58 PM, Ali, Haneef wrote: >>> >>>> Hi , >>>> >>>> I have a tar task which creates a tar of junit report which will be >>>> published in another location. All I want to do is, call this task in >>>> test irrespective of test failure or success. I tried task.execute() and >>>> it doesn't seem to work. Am I missing something >>>> >>>> >>>> >>>> task reportsTar(type: Tar ) { >>>> // from, to configuration >>>> } >>>> >>>> >>>> test { >>>> afterSuite{ >>>> if (!it.parent){ >>>> reportsTar.execute() >>>> } >>>> } >>>> } >>>> >>>> >>>> Thanks, >>>> Haneef >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe from this list, please visit: >>>> >>>> http://xircles.codehaus.org/manage_email >>>> >>>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe from this list, please visit: >>> >>> http://xircles.codehaus.org/manage_email >>> >>> >>> >> > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
