Is there possibility to run single task twice during build script execution?


(bogaty_f1) #1

Is there possibility to run single task twice during build script execution? I need to run one task twice.

That’s because I want to run it with different settings.

The only thing I see now, is to make an external build.gradle. Even though it is not so obvious for me


(Gary Hale) #2

There is no way to add a task to the task graph twice. It may not be immediately intuitive, but what you likely want is to have two different tasks of the same type, each named/configured differently (rather than a single task run twice).


(bogaty_f1) #3

Yeah, solved it by using two build.gradles which are running in a sequence one after another from root build.script


(bogaty_f1) #4

In my case decided to run the script twice, from the root build script. But actually there is a possibility to run method twice with this construction, but bad thing is that it is not launching all depending task task insertion() << {

tasks.taskA.execute() } <.code>


(uklance) #5

I think you should do:

task insertion << {
    // do stuff
}
  insertion.dependsOn taskA