groovy - Construct/Destruct custom gradle task -
i'm totally new in gradle/groovy. want create custom task stuff. first problem how when task finishes job? can override dofirst/dolast closures? maybe can override method @ beginning , @ end?
this "task"
import java.nio.file.files class mycustomtask extends defaulttask { file builddir file tempdir public mycustomtask() { super() builddir = project.getbuildfile().getparentfile() tempdir = files.createtempdirectory(builddir.topath(), "mycustomtask").tofile() } @taskaction def build() { println("test"); } // want delete tempdir ater task execution }
as says on official gradle forums (where asked same question), should either
- wrap
build()
code intry...finally
block - or write custom task folder
build
directory gets cleaned when usergradle clean
Comments
Post a Comment