From d990899a5c9a997b7347ebbd16b5a7b3a7475590 Mon Sep 17 00:00:00 2001 From: Juraj Michalek Date: Fri, 9 May 2014 16:28:50 +0200 Subject: [PATCH] add doFirst example --- 10-custom-task-dofirst/build.gradle | 14 ++++++++++++++ README.md | 13 ++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 10-custom-task-dofirst/build.gradle diff --git a/10-custom-task-dofirst/build.gradle b/10-custom-task-dofirst/build.gradle new file mode 100644 index 0000000..7b005a4 --- /dev/null +++ b/10-custom-task-dofirst/build.gradle @@ -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" + } +} diff --git a/README.md b/README.md index 005cb09..b782089 100644 --- a/README.md +++ b/README.md @@ -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