I have a domain object that I would like to make B...
# community-support
s
I have a domain object that I would like to make Buildable, how do I best implement the interface? Can I return my own implementation of TaskDependency or should I ask Gradle to create one? How?
m
Can you explain more about your use case? Couldn't you use an existing implementation of buildable and delegate to that?
ConfigurableFileCollection
is buildable, for example and has
builtBy
method which you could use.
I'm not saying that this is the best way but it is a way...
I think I implemented a
TaskDependency
myself in the past and I don't remember having any problems with that
But I would love to hear more about your use case 🙂
s
I have a domain object collection, my plugin creates a task or two for each object in the collection. I want users to be able to pass my object to Task#dependsOn and have it be equivalent to adding a dependency on one of the tasks associated with the object.
m
I see. One thing to note is that explicit dependsOn calls for non-lifecycle tasks are a bit of an anti pattern. Can't you expose these dependencies by providing a collection of output files that the tasks associated with your domain object produce?
☝️ 1