Add an ImagesLifecycleTask to pass options along to source set tasks - #75
Conversation
also not really familiar with this. |
f90540c to
2ab2eb6
Compare
2ab2eb6 to
5b9116f
Compare
eric-labelle
left a comment
There was a problem hiding this comment.
approving to unblock the stack, we can revise after if Josh has suggestions/concerns.
|
I see that Tony Robalik actually published a blog post yesterday that addresses something similar! It's implemented somewhat differently because, it modifies the existing The other takeaway is that "Aggregate" is probably not the right term here (not surprising, I don't know the terminology so I made something up). Tony describes these as "lifecycle" tasks, so I think it makes sense to call this something like |
c2ea8bf to
e045497
Compare
AggregateTask to pass options along to source set tasksLifecycleImagesTask to pass options along to source set tasks
e045497 to
2135706
Compare
LifecycleImagesTask to pass options along to source set tasksImagesLifecycleTask to pass options along to source set tasks
2135706 to
87d3940
Compare
87d3940 to
807fe73
Compare
807fe73 to
4dc8ace
Compare
There was a problem hiding this comment.
One thing that we could also do to take this a step further is have CompressTask, DecompressTask, and VerifyTask all extend this base class instead of DefaultTask, so they're all guaranteed to share the same --images option.
Or instead of extending ImagesLifecycleTask directly, we could make something like a HasImagesOption interface that the lifecycle and source set tasks all implement.
Context
Right now you can't filter any of the Microfilm tasks. So if you want to compress/verify a specific image, you have to compress/verify the whole module. I think it would be helpful to be able to run tasks on a subset of images, similar to how you can filter tests with the
--testsoption.This PR
The new
--imageoption is attached to the source set specific tasks, so this works:But if you try to pass a filter to the parent task it fails:
I think this is relatively common for Gradle tasks, but it doesn't feel like a great user experience. I'm proposing that we add an
ImagesLifecycleTaskthat does nothing except pass these options along to the source set tasks. I'm not that familiar with Gradle task options, so if there's a good reason not to do this, let me know!