add doFirst example

This commit is contained in:
Juraj Michalek
2014-05-09 16:28:50 +02:00
parent 64f78ee11c
commit d990899a5c
2 changed files with 26 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
task helloWorld {
// Configuration phase - Gradle learns about tasks.
// This scope is executed first
description "Say hello :-)"
doFirst {
// Execution phase
println "Sunny day."
}
doLast {
// Execution phase
println "Greetings from Brno"
}
}

View File

@@ -85,6 +85,8 @@ Gradle is able to generate project files for Visual Studio for C/C++.
gradle mainVisualStudio
ii .\visualStudio\mainExe.sln
Solution file is stored in visualStudio/mainExe.sln
## 09-custom-task-dolast
@@ -96,4 +98,13 @@ will execute always even when you run `gradle tasks`
gradle tasks
gradle helloWorld
Solution file is stored in visualStudio/mainExe.sln
## 10-custom-task-dofirst
doLast allows to append execution code at the end of task. There is another
method doFirst which prepends code before current code. It's useful when
building decorators.
gradle tasks
gradle helloWorld