Starting with Gradle 4.2 - I have run into this “feature” - https://docs.gradle.org/4.2/release-notes.html#safer-handling-of-stale-output-files
I am building my own plugin which is wiring 2 other plugins together (both plugins I do not own). Envision this scenario:
- Plugin A (I do not own) has task B, which outputs some files into directory C (under $buildDir)
- Plugin X (I do not own) has task Y, which outputs some files into directory Z (under $buildDir)
- Plugin D (I own) has a Copy task E. Task E copies a certain subset of files from directory Z and places them into directory C
- Task E in plugin D dependsOn tasks B & Y, so they will run first
Everything was great until I tried to update to Gradle 4.2 and hit the safer handling of stale output files. Now when task E goes to run, it first deletes the contents of directory C, since it considers it “stale”, even though my goal is to copy additional files into a directory which already existed.
How do I stop this behavior?