Question: In Gradle 8.10, apparently this doesn't ...
# kotlin-dsl
k
Question: In Gradle 8.10, apparently this doesn't compile:
Copy code
val foo by if (condition) {
  tasks.registering
} else {
  tasks.registering(Foo::class)
}
and I would need to do this instead:
Copy code
val foo by if (condition) {
  tasks.registering(DefaultTask::class)
} else {
  tasks.registering(Foo::class)
}
Is this a thing in newer versions of Gradle?
e
I'd swap that around to
Copy code
val foo by tasks.registering(
    if (condition) DefaultTask::class else Foo::class
)
anyway, and in that form you can add a configuration block etc. to the call
v
Very limited though. Only things of interfaces that are in both task types. In the original form you can do the full
Foo
configuration. Without configuration block I agree though.