mirror of
https://github.com/ysoftdevs/gradle-training.git
synced 2026-06-27 15:56:44 +02:00
Add example with custom task in one and separate files
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
apply plugin: 'groovy'
|
||||
|
||||
import com.ysoft.greeting.GreetingTask
|
||||
|
||||
task hello(type: GreetingTask)
|
||||
|
||||
// Customize the greeting
|
||||
task greeting(type: GreetingTask) {
|
||||
greeting = 'greetings from Brno'
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.ysoft.greeting
|
||||
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
class GreetingTask extends DefaultTask {
|
||||
String greeting = 'hello from Y Soft'
|
||||
|
||||
@TaskAction
|
||||
def greet() {
|
||||
println greeting
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user