I understand that the gradle DSL
task doTask { logger.info "some text" }
will actually call the method task(String,Closure) on the Project delegate object. It's more or less a short hand for
task("doTaks", {logger.info("some text")})
That's all fine. But things get complicated when I try to understand some gradle DSL syntax I've seen in third party build scripts:
task doTask (dependsOn: 'otherTask'){logger.info "some text"}
I figure that groovy will create a map from (dependsOn: 'otherTask'), and that somehow the Project method
task(Map args, String name, Closure config)
will be called. But how do these additional parentheses come into play, why are they necessary, how does groovy figure out what we want here? The syntax looks totally counter-intuitive to me with my minimal groovy skill. I would never guess that I have to do it this way to make it work.
So, that's the question: how does groovy figure out what to do with this command:
task doTask (dependsOn: 'otherTask'){ // some code }