Cleanup stale output files during execution (#2572) We now keep a registry of all the outputs generated by Gradle which will be reset on each version change. If Gradle encounters an existing output file, then it will remove it if is not part of the registered outputs and owned by Gradle/the build. We do also not remove directories containing outputs from different tasks. The check to delete the stale outputs happens now just before the task executes and not up-front as it did before. The `build` directory and all delete targets of the `clean` task are registered as owned by Gradle and are considered safe to delete. Currently, the set of recorded task output files is only growing if we do not change the Gradle version. In the future we can improve on this by also detecting that some directories where removed (e.g. by running a clean task) and reflect this in the registry.