https://kotlinlang.org logo
Title
m

Marcel Overdijk

12/22/2017, 9:48 AM
or is there a cleaner approach with kotlin dsl?
g

gildor

12/22/2017, 9:58 AM
nope, if you need to configure task you always provide name of task (using string + invoke, or using field delegates) and type of this task. More cleaner approach is completely in hands of plugin creator, who can provide configuration API based on extension instead of tasks
👏 1
@bamboo Is that planned to push plugin authors to use extensions to configure default task settings, instead of configure them directly, I’m talking about some kind “best practices” guide. Also, would be nice to see this approach in Gradle Core plugins Because with Groovy it looks identically, but with Kotlin DSL task configuration still looks awkwardly to be honest, and even if dsl will be improved, you should know task class to configure it.
b

bamboo

12/22/2017, 4:01 PM
I’m sure @bmuschko would have much more to say about it but I think that’s always been a “best practice”. I see it as a sort of porcelain/plumbing sort of thing, extensions are porcelain, tasks are plumbing. Or to use another analogy, extensions to make the easy jobs easy, tasks to make the hard jobs possible.
and even if dsl will be improved, you should know task class to configure it.
We are considering providing accessors for tasks known after plugin application but indeed that will still leave out some tasks.
Any suggestions on how to make build authors life easier in that regard is very much welcome.