>From the perspective of someone who's been using gradle for about a month
now (not a beginner, not an expert), I just ran into what seems like a
dangerous syntax issue.
Here's how the confusion happened:
sample build.gradle:
-----------------
task a << {
println 'executing a'
}
task b(dependsOn: a) {
println 'executing b'
}
-----------------
Sample output of "gradle -q b":
executing b
executing a
My intention was that task "b" depends on task "a", so I'd expect task "a"
to be run first. It's not though, and a keen eye would notice that task b
is missing the doLast shortcut. Of course my real world situation was more
complex than this, so it took a while to notice the mistake. I guess it was
all those years of ant and maven, without the added factor of
doFirst/doLast.
It seems to me that this situation should result in a syntax error or
warning. i.e. I can't think of a situation where I'd want a task that
depends on another task, having code that runs before the prequisite task.
Are there situations where this kind of a situation is actually desired?