How to declare a 'facade' task in gradle


(hw.kirk) #1

I want to ensure that all my company’s (currently 5 and growing) gradle projects can be built with the same task (eg, ‘buildIt’ )

This practice will obviously avoid having to remember the task sequence by all the developers for each gradle project.

To repeat the obvious, I want the task ‘buildIt’ to call the desired tasks to build the (typical) use case of that gradle project.

cd projectA > gradle buildIt > cd projectB > gradle buildIt

What is the best way to do that in gradle?

This question takes me directly into the related question of how to sequence tasks.

I continue to be impressed by the depth, power and elegance of gradle yet get stopped cold at what are seemingly simple things.

Thanks in advance I am currently on gradle 1.4 (migrating to 1.8)


(Peter Niederwieser) #2

You’d write a plugin that declares a ‘buildIt’ task and establishes the necessary task relationships ( ‘dependsOn’, ‘mustRunAfter’). A task can’t call other tasks, but can be in a relationship with them.


(hw.kirk) #3

OK.

This makes sense now ( and I can do this even without using a plugin)

It will lead me to another question which I will post.

Thanks