In the passed it was “common” to use
task.outputs.file(someFile) to (conditionally) add output(s) to a task. However, the type returned by
getOutputs() method changed around Gradle 3 to the internal
TaskOutputsInternal class (in addition to the incompatible change in
TaskOutputFilePropertyBuilder which prevents plugins built with Gradle 4 to be run with Gradle 2).
What’s the recommended way of dealing with conditional task’s outputs (preferably the one which is compatible with both Gradle 4 and Gradle 2)?