Slackbot
03/11/2023, 4:06 AMMartin
03/11/2023, 3:06 PMMartin
03/11/2023, 3:07 PMAction<T>
:
abstract class MyExtension {
fun nested(block: Action<MyNested>) {
// stuff
}
}
Martin
03/11/2023, 3:08 PMmyExtension {
nested {
// bla
}
}
Daymon
03/16/2023, 7:37 PMabstract class DocumentationPluginExtension : ExtensionAware {
internal val content = extensions.create<ContentConfiguration>("content")
}
abstract class ContentConfiguration {
abstract val fontSize: Property<Int>
}
The usage of create
automatically creates an identical structure as defined above. Alternatively, we could do something like this:
abstract class DocumentationPluginExtension : ExtensionAware {
val content: ContentConfiguration
fun content(block: ContentConfiguration.() -> Unit) {
content.block()
}
}
abstract class ContentConfiguration {
abstract val fontSize: Property<Int>
}
And it would almost accomplish the same thing- although there are some obv things missing, like the instantiation of ContentConfiguration
.
My question is, what is the intended way to draw relationships between two extensions? In the Gradle ecosystem there are a lot of ways to do the same thing- and a lot of common code smells that folks have adopted over the years. We actively want to avoid those, and make sure in our modernization efforts that we're aligned with Gradle's current/future API design plans.Martin
03/16/2023, 7:42 PMMartin
03/16/2023, 7:42 PMAction
instead of Kotlin functions if you care about Groovy users