'Alter outputs for gradle task

I am having some code being generated into a directory via the gradle openApi plugin. The output directory specified in the org.openapitools.generator.gradle.plugin.tasks.GenerateTask task is automatically added to the gradle outputs variable (which is used to determine whether the task is up-to-date). However, in a subsequent task i need to alter some files in the directory (due to them being generated incorrectly) and thus, in order to avoid an unncessary update, I would like to restrict 'outputs' to a subdirectory of the directory structure generated whose contents are not altered.

My question then is this: Is there a way to empty the 'outputs' variable in the task and then add the subdirectory via outputs.dir "${mySubDir}"?

Maybe i am overlooking a better solution approach, so i would be open to that as well.

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source