Michal Klimczak
09/22/2021, 7:19 AM//using just String
myPlugin {
foo = "bar"
}
//using Property
myPlugin {
foo.set("bar")
}
mbonnin
09/22/2021, 7:26 AMFleshgrinder
09/22/2021, 7:26 AMFleshgrinder
09/22/2021, 7:28 AMmyPlugin {
foo.set(provider { "lazy" })
}
configure<MyPlugin> {
foo = "lazy"
}
mbonnin
09/22/2021, 7:31 AMmbonnin
09/22/2021, 7:31 AMFleshgrinder
09/22/2021, 7:33 AMMichal Klimczak
09/22/2021, 7:53 AMFleshgrinder
09/22/2021, 7:55 AMfoo
task. We execute the bar
task, hence, nothing foo
needs will be required. With an eager API everything for foo
will be computed, even though we run bar
. With a lazy API nothing gets computed for foo
, since we run bar
.Michal Klimczak
09/22/2021, 7:57 AMmbonnin
09/22/2021, 7:58 AMephemient
09/22/2021, 8:27 AM@get:Input abstract val fooProperty: Property<T>
@get:Internal var foo: T by fooProperty
but it looks strange and is not worth the extra hassle, IMOmbonnin
09/22/2021, 8:34 AMephemient
09/22/2021, 8:37 AMmbonnin
09/22/2021, 8:41 AMmyPlugin {
foo("bar")
}
@tony wrote a nice article about this there: https://dev.to/autonomousapps/gradle-plugins-and-extensions-a-primer-for-the-bemused-51lpBig Chungus
09/22/2021, 8:52 AM