I am new to Gradle and Groovy and trying to understand what is happening at the level of groovy when a gradle task is defined.
task hello {
println "configuring task hello"
doLast {
println "hello there"
}
}
From reading the "Gradle In Action" book I know that the task hello {}
is a really a call to the task()
method of the groovy Project
interface. On page 77 it shows that there are 4 methods called task on the Project
interface
task(args: Map<String,?>, name:String)
task(args: Map<String,?>, name:String, c:Closure)
task(name: String)
task(name: String, c:Closure)
I understand that the {}
is the closure body.
What I don't understand is how does groovy interpret hello
in task hello { }
according to https://stackoverflow.com/a/25592665/438319 there is a groovy compiler plugin that converts task hello { }
into task('hello', { })
My Questions:
Where can I find information about the Gradle Groovy Compiler plugin that does the conversion?
Is the claim that Gradle scripts are groovy programs technically incorrect since gradle somehow extends the Groovy programming language?
Is there a way to get the
gradle
command to print out the base groovy code that is generated after the compiler plugin has run?