Plugins: Complex Custom task type or dependency chain?

plugins

(Markus Perndorfer) #1

My question is similar to the one asked here:

The difference is:

I’m trying to write a Gradle plugin (in Java) and one of the tasks it should provide requires multiple processing steps (build, generate some custom folder structure in a temp folder, copy and generate files, zip everything together and a few other things).

Should I hide this complexity in a huge custom task class (and possible re-implement a lot of stuff) or preconfigure smaller tasks + dependencies to leverage task types gradle provides out-of-the-box?

What’s the more “gradle” solution for plugins?


(Benjamin Muschko) #2

I’d create one task for each step and chain them together with task dependencies. The benefit is that is easier to use core task types and you know exactly what failed if something fails.


(Stefan Oehme) #3

Also you get finer grained caching and up to date checking that way. If step one produces the same output, then step 2 and 3 will be up to date. If everything is in one big step, it’ll all rerun.