Multi-project task dependencies


(Nishant Agarwal) #1

I have a flat-multi-project structure like below: A --build.gradle B --build.gradle

A task taskA in project A when called has to do something like this.

taskA{
  //do something -- usually set a global parameter
  //call projectB.taskB to execute
}

dependsOn fails because: 1. taskA(dependsOn : ‘:projectB:taskB’) – this fails because taskB requires value set by taskA at line1 to execute 2. taskB(dependsOn : ‘:projectA:taskA’) – this is of no use because taskA is my main (visible) task and this does not assures “taskB must run after taskA”

I tried mustRunAfter() but i think it has been deprecated.

It looks simple but I cannot figure out the workaround. Can you please help me out here.

FYI: I am moving from ant to gradle build and this particular logic is related to antcallback functionality

<antcallback antfile="${custom.dir}/pabuild/extension.xml" target="isActionRequired" return="requireAction">
  <param name="currentTask" value="deploy"/>
 </antcallback>

Thanks. Nish.


(Luke Daley) #2
  1. taskB(dependsOn : ‘:projectA:taskA’) – this is of no use because taskA is my main (visible) task and this does not assures “taskB must run after taskA”

It does guarantee that taskA is run before taskB.

This seems to be all you need.