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.
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!