mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-04-18 22:50:32 +02:00
Add example with custom task in one and separate files
This commit is contained in:
18
21-custom-task-in-one-file/build.gradle
Normal file
18
21-custom-task-in-one-file/build.gradle
Normal file
@@ -0,0 +1,18 @@
|
||||
// Based on example: https://gradle.org/docs/current/userguide/custom_tasks.html
|
||||
|
||||
// Use the default greeting
|
||||
task hello(type: GreetingTask)
|
||||
|
||||
// Customize the greeting
|
||||
task greeting(type: GreetingTask) {
|
||||
greeting = 'greetings from Brno'
|
||||
}
|
||||
|
||||
class GreetingTask extends DefaultTask {
|
||||
String greeting = 'hello from Y Soft'
|
||||
|
||||
@TaskAction
|
||||
def greet() {
|
||||
println greeting
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user