I don’t want to delete what is currently marked as output for a task, but what was produced by the last run of the task.
This is to prevent a problem where someone forgets to clean, changes say the output path, runs again.
Currently my task deletes outputs.files first, but when someone changes the directory path of the output in between runs without a clean, this causes it to delete the /currently/ defined directory (which doesn’t exist yet). Gradle handles this gracefully and does not fail the build, but the old output from the previous run is left around and forces us to do a full clean build since clean will clean the now currently defined outputs or find out where these outputs have changed manually. A directory is a small think to find, but more granular results are really horrible, and when it takes a long time to build, this is pretty awful. I just want to delete the previous run’s outputs for that task, which I would think is a key requirement of a build framework.
I know gradle somewhere has access to this information because it has to use it for incremental task checking, but I’m wondering if there is something accessible in the api. I would think there needs to be to support users who want to write their own upToDateWhen criteria by including standard criteria and adding to it. Seems like a decent use case.