Slackbot
02/10/2024, 11:38 AMVampire
02/11/2024, 3:37 PM.all
on the collection?Philip W
02/11/2024, 4:01 PMVampire
02/11/2024, 4:24 PMbut I don’t want to use afterEvaluate at all👌
The domain object registers a task during its init block. When I call extension.foo.register, the task isn’t registered because the extension.foo is never collected/called.Yeah, well, that's expected. If you treat the container lazy by only using things like
register
and configureEach
and so on, the elements are never realized and so their init blocks never called.
If you do foo.all { }
, the laziness is killed - which might be ok, most containers in Gradle itself are also not treated lazily - but all of the elements get realized which is what you want, as the alternative, calling them in afterEvaluate
would also need to do the same.Philip W
02/11/2024, 4:29 PMVampire
02/11/2024, 4:30 PMVampire
02/11/2024, 4:31 PMtasks
.Vampire
02/11/2024, 4:31 PM.all { }
on them, or do any other action that causes all to be realized.Vampire
02/11/2024, 4:32 PMVampire
02/11/2024, 4:33 PM.all { }
action that registers the additional tasks, which then in turn would cause the elements to all be realized.Philip W
02/11/2024, 4:48 PMVampire
02/11/2024, 5:04 PMPhilip W
02/11/2024, 5:50 PMelements
property of DomainCollection too, like FileCollection.getElements()
.Vampire
02/11/2024, 5:53 PMVampire
02/11/2024, 5:53 PMPhilip W
02/11/2024, 6:04 PMFileCollection
.Vampire
02/11/2024, 6:18 PM