Automatic clean tasks

I’m trying to wrap my head around how to best use the automatic clean tasks, generated by the base plugin. It seems to me like there a default task “clean”, which only deletes the build folder, and then for every other task Foo, there’s a corresponding cleanFoo task being generated which cleans the declared outputs of that task. However, this cleanFoo task doesn’t consider any of Foo’s dependencies, nor does it add itself as a dependency on the base clean, as far as I can tell. Does this means I either make sure everything goes into the build folder (which I can’t for various reasons), or do I need to manually manage/link the dependency clean tasks?

Managing the dependencies myself is of course doable, and even makes sense in some way. I’m just curious if I’m overlooking something that would make this more intuitive to use.

You can either make the tasks a dependency of clean.

Or you can add to clean by doing:

clean {
    delete files(...)
}

Thanks, yes I had gotten that far.

Since Gradle offers a great range of ways of doing everything from manual bit-manipulation to high-order-magic, I’m just trying to confirm that I wasn’t overlooking anything regarding the automatically created clean tasks.