I’m trying to do something similar to what has been posted in the past and I believe I am either hitting a regression bug, something I’m doing wrong, or something that has been deprecated/removed. I am using Gradle 2.8.
Starting with some working code:
@Managed
interface Inner {
void setSomething( String something )
String getSomething()
}
@Managed
interface Outer {
Inner getInner()
}
class NestedRules extends RuleSource {
@Model void outer( Outer out ) {}
@Mutate void createTask( ModelMap<Task> tasks, Outer out ) {
tasks.create( 'printInner' ) {
doLast {
println out.inner.something
}
}
}
}
apply plugin: NestedRules
model {
outer {
inner.something = 'Hi'
}
}
All is well with the printInner task:
$ ./gradlew printInner
:printInner
Hi
Now I want to enable configuration of inner using the following syntax:
model {
outer {
inner {
something = 'Hello'
}
}
}
So based on the previously mentioned post I tried adding the following to the RuleSource:
@Model void inner( Inner inner ) {}
which fails with:
A problem occurred configuring root project 'gradle-model-test'.
> Exception thrown while executing model rule: model.outer
> Could not find method inner() for arguments [build_11skrf6fkeskg40vkwyzi3uh7$_run_closure2$_closure3$_closure4@e56dbc1] on root project 'gradle-model-test'.
Based on my understanding it makes sense that I now have a working root inner() method, but I’m not sure how to get an outer.inner() method working instead. i.e. this now configures successfully but isn’t what I want:
model {
outer {
inner.something = 'Hi'
}
inner {
something = 'Hello'
}
}
Thanks, Chris