This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from praqma-training/task-creation
Clean up and expand the task-creation kata
- Loading branch information
Showing
1 changed file
with
33 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |