@SkipWhenEmpty breaks incremental builds when last file is removed

Here’s a scenario:

  1. Create a new project with a build.gradle that only applies the java plugin
  2. create a file: src/main/resources/foo.txt
  3. build, check the jar contains foo.txt
  4. Remove the foo.txt file
  5. Build, notice the file is still in the jar file.

When running build in step #5 with --info it’ll say:

Skipping task ‘:processResources’ as it has no source files.

The task should know it had inputs on the previous run and therefore should run again.
Tested and verified same behavior on Gradle 2.2.1, 2.5 and 2.7