mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-04-14 12:40:03 +02:00
add doFirst example
This commit is contained in:
14
10-custom-task-dofirst/build.gradle
Normal file
14
10-custom-task-dofirst/build.gradle
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
13
README.md
13
README.md
@@ -85,6 +85,8 @@ Gradle is able to generate project files for Visual Studio for C/C++.
|
|||||||
gradle mainVisualStudio
|
gradle mainVisualStudio
|
||||||
ii .\visualStudio\mainExe.sln
|
ii .\visualStudio\mainExe.sln
|
||||||
|
|
||||||
|
Solution file is stored in visualStudio/mainExe.sln
|
||||||
|
|
||||||
|
|
||||||
## 09-custom-task-dolast
|
## 09-custom-task-dolast
|
||||||
|
|
||||||
@@ -96,4 +98,13 @@ will execute always even when you run `gradle tasks`
|
|||||||
|
|
||||||
gradle tasks
|
gradle tasks
|
||||||
gradle helloWorld
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user