Hi,
Suppose I add an extension object to a Jar
task’s ExtensionContainer
, in order to extend its DSL like this:
jar {
myExtension {
myInput = 'myCustomValue'
}
}
where
class MyExtension @Inject constructor(objects: ObjectFactory) {
@Input
val myInput: Property<String> = objects.property(String::class.java)
.convention("burble")
}
I have previously been assuming that Gradle will detect the myInput
property and its @Input
annotation automatically, but now I am not so sure… Do I actually need to register this property manually via TaskInputs? Something like:
tasks.named('jar', Jar) {
inputs.property('myInput', myExtension.myInput)
}
I see this approach explicitly states that it does not support @Nested
, presumably to prevent me from doing something like this:
tasks.named('jar', Jar) {
inputs.nested(myExtension)
}
This is exactly what I really want to do, of course. Does inputs.property(name, value)
at least work with “lazy” properties and task configuration avoidance please?
Thanks,
Chris