4.times{counter->task"task$counter"(dependsOn:"depending$counter")<<{println"I'm task number $counter"}}4.times{counter->task"depending$counter"<<{println"I'm depending number $counter"}}
执行结果如下:
gradle -q task1
12
I'm depending number 1
I'm task number 1
多次定义Task的依赖
build.gradle
12345678910111213
4.times{counter->task"task$counter"(dependsOn:"depending$counter")<<{println"I'm task number $counter"}}task0.dependsOntask1,task24.times{counter->task"depending$counter"<<{println"I'm depending number $counter"}}
执行结果如下:
gradle -q task0
123456
I'm depending number 0
I'm depending number 1
I'm task number 1
I'm depending number 2
I'm task number 2
I'm task number 0