See #35.
Can Kotlin do
sourceSets {
"main" {
}
}
?
@oehme, yes and I was considering to use that syntax for #35 since it implies a cardinality of _many_ and it's similar to the Groovy version.
If it can do that, can it also do sourceSets."main"?
No, not that but it can do sourceSets["main"].
I think that's even better when you think of it as a container or map.
@oehme, I agree that for accessing an existing element it probably won't get better than that.
How do you envision the configuration of an existing source set, for example?
sourceSets["test鈥淽.compileClasspath = configurations["compileClasspath"] + sourceSets["main鈥淽.output
Must be designed together with #35.
Consider also the contrast between eager and lazy configuration methods such as getByName and withType.
As of #35, it is now possible to select and configure tasks with the following patterns:
Use the collection indexer.
task["jar"].dependsOn("someOtherTask")
Invoke the task container (works with any DomainObjectContainer).
tasks {
"jar" {
dependsOn("someOtherTask")
}
"clean"(Delete::class) { // specify type information so `delete` is available
delete("someOtherDir")
}
}
Declare a delegated property using the container as a delegate (works with any DomainObjectCollection).
val jar: Jar by tasks
jar.apply {
from(sourceSets["main"].allSource)
from(sourceSets["test"].allSource)
}
tasks["build"].dependsOn(jar)
Most helpful comment
As of #35, it is now possible to select and configure tasks with the following patterns:
Select single task by name
Use the collection indexer.
Configure multiple tasks by name
Invoke the task container (works with any
DomainObjectContainer).Bring a task into scope for multiple references
Declare a delegated property using the container as a delegate (works with any
DomainObjectCollection).