forked from gradle/kotlin-dsl-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
48 lines (35 loc) · 987 Bytes
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* An example Gradle task.
*/
open class GreetingTask : DefaultTask() {
val message = project.objects.property<String>()
@TaskAction
fun greet() = println(message.get())
}
tasks {
// `hello` is a `TaskProvider<GreetingTask>`
val hello by registering(GreetingTask::class) {
message.set("Hello!")
}
// `goodbye` is a `TaskProvider<GreetingTask>`
val goodbye by registering(GreetingTask::class)
// Every `NamedDomainObjectProvider<T>` can be lazily configured as follows
goodbye {
dependsOn(hello)
}
// Existing container elements can be lazily configured via the `String` invoke DSL
"goodbye"(GreetingTask::class) {
message.set("Goodbye!")
}
// Regular API members are also available
register("chat")
}
// ...
tasks {
// Existing container elements can be lazily brought into scope
val goodbye by existing
"chat" {
dependsOn(goodbye)
}
}
defaultTasks("chat")