The following is from the User Guide :
task(hello) << {
println "hello"
}
task(copy, type: Copy) {
from(file('srcDir'))
into(buildDir)
}
I’m confused as to how this works. Is “task” a keyword, a method invocation, etc.?
I thought they were method invocations on the Project object, but the API for that class doesn’t show any matching signatures . . .
So, how is ‘hello’ a string? That method takes a string; that’s part of what I don’t quite understand.
And, then the second one?
The following DSL syntax…
task copy(type: Copy) {
from srcDir
into buildDir
}
…is rewritten to…
project.task("copy", type: Copy) {
from srcDir
into buildDir
}
…by way of a Groovy compiler plugin (AST transform).
Thanks Peter! I guess I’m sometimes confused because as a groovy noob and a gradle noob, it’s sometimes hard to tell whether the syntax is coming from groovy or the gradle DSL.
Thanks Peter! I guess I’m sometimes confused because as a groovy noob and a gradle noob, it’s sometimes hard to tell whether the syntax is coming from groovy or the gradle DSL.