From 5c84d6921eb91a1d46631253c2726687fe07e084 Mon Sep 17 00:00:00 2001 From: Michael Ingeman-Nielsen Date: Wed, 26 Feb 2020 15:29:27 +0100 Subject: [PATCH] update task-creation kata --- task-creation/README.md | 44 ++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/task-creation/README.md b/task-creation/README.md index 9158c36..93b01a5 100644 --- a/task-creation/README.md +++ b/task-creation/README.md @@ -1,22 +1,44 @@ -# Task creation +# Gradle Kata: Task creation -## Hello, world +## Setup -Create a task called `hello` that prints `Hello, world!` when executed. +Run `source setup.sh` +## Task + +### Creating your first Gradle task + +- You are in a newly created Gradle project. Examine the available tasks using `./gradlew tasks` +- Create your first task by copying the following code to `build.gradle` + ``` + task hello { + println "Hello, friend!" + } + ``` - Run `./gradlew` -- Q: Did Gradle print `Hello, world!`? If so, what happened? +- Q: Did Gradle print `Hello, friend!`? What happened? Inspect the full output from the command - Run `./gradlew hello` - Q: Was the output as expected? -- How can you avoid `Hello, world!` be printed out in the configuration phase? -## Task properties +### Task properties - Run `./gradlew tasks` -- Q: Is your 'hello' task listed? -- Q: Can you get `./gradlew tasks` to list it anyway? +- Q: Is the "hello" task listed? +- Run `./gradlew tasks --all` +- Q: Is the "hello" task listed now? In which group? +- Add a Group and a Description to the task: + ``` + task hello { + group "Greeting" + description "prints a warm greeting" + + println "Hello, friend!" + } + ``` +- Run `./gradlew tasks` +- Q: Is your tasks visible? In the correct group? And with the correct description? -Configure the group and description of your task. -- Run `./gradlew tasks` -- Q: Is your tasks visible and defined according to its purpose? +## Useful commands +- `./gradlew tasks` +- `./gradlew tasks --all`