dependsOnTaskDidWork always returns false when depending on build/classes task


(Daryl Teo) #1

https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/groovy/org/gradle/api/internal/AbstractTask.java?source=c#L402

Seems like this method only checks direct dependencies for work status. “build” or “classes” never does any work, but the tasks it depends on may have done work. Unsure if this is by design or an oversight.


(Szczepan Faber) #2

Technically, the current behavior is correct (see the javadocs for dependsOnTaskDidWork and getDidWork()). The ‘classes’ task did not work, however it’s upstream dependencies may had worked.

Perhaps in your scenario you’d need something like ‘recursive’ getDidWork(), however, Gradle does not offer anything like that atm.

Hope that helps!