Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle custom task order on Android

I have 2 gradle tasks that i want to run after assembleRelease task.

task copyRequiredFilesToVersionControl(type:Copy) {
  ...
}

task ('versionControl') << {
  ...
}

If I configure order for these tasks as below tasks get never called...

copyRequiredFilesToVersionControl.dependsOn(assembleRelease)
versionControl.dependsOn(copyRequiredFilesToVersionControl)

If i change order like;

assembleRelease.dependsOn(copyRequiredFilesToVersionControl)
versionControl.dependsOn(copyRequiredFilesToVersionControl)

Tasks are run at the beginning of document. So there is no file to copy and add to version control.

What is the best approach?

like image 706
Alkimake Avatar asked Dec 30 '13 14:12

Alkimake


1 Answers

I have found method that called doLast. So i fixed my problem with it.

assembleRelease {
    doLast {
        tasks.versionControl.execute()
    }
}
like image 63
Alkimake Avatar answered Oct 22 '22 13:10

Alkimake