In section 57.2.1, “Defining common behavior”, I saw something that I imagine I’ve seen before, but I didn’t realize it. Here’s the code sample:
allprojects {
task hello << {task -> println "I'm $task.project.name" }
}
subprojects {
hello << {println "- I depend on water"}
}
The first part that defines the “hello” task uses the “task” keyword. The second segment configures part of the “hello” task, but it doesn’t use the “task” keyword. I’ve verified that the second piece is not able to use the “task” keyword. If I add that, it fails, saying it’s a duplicate task.
It appears that adding task configuration without the “task” keyword assumes that there is an occurrence of the “task” keyword for that task somewhere else, and this just augments that definition. This section where I first noticed this makes no mention of this.
Is this behavior documented somewhere else in the User Guide?