Open dtbullock opened 3 years ago
Maybe better vararg
s than explicit Array
s
It might even be better to not use ext
properties at all which are in most cases just work-arounds instead of doing it properly.
Instead it would probably be more appropriate to add an extension to the tasks. Unfortunately there will not be accessors generated for the Kotlin DSL, but as it will be available on all tasks, it would probably be ok to provide the accessors with the plugin. For Groovy DSL it would simply work. And it would then be for example
tasks.register("foo") {
propertyRules {
require("foo")
recommend("bar", "baz")
}
}
To invoke the groovy methods installed as extension properties of Task objects by applying
gradle-properties-plugin
from the Gradle Kotlin DSL using the 'check required properties as the first line of the task ' idiom, it is necessary to first install some Kotlin extension methods:It is then possible to use the suggested 'property check' idiom from scripted tasks:
Notwithstanding the major design change (?) to be provoked by the configuration cache in future versions of Gradle, it'd be sweet if
gradle-properties-plugin
could distribute these extensions!