Using the software model for new plugin

I’m working on a plugin which wraps an external toolchain. The toolchain produces a number of different binaries depending on the platform and configuration. It has various inputs, sources and other assets, but doesn’t build them individually. It takes a project file, and produces the binaries. However, it’s pretty slow and complex, so I avoid calling it when I can detect that inputs and outputs are up to date. This works fairly well in a completely custom plugin which isn’t using the software model per se, but I always like to follow best practices when possible, both to benefit from existing work, and to ease the learning curve of users/developers.

To perhaps explain a little better, think of this as an external tool like “make”, or “ant”, which I want to call only when I’ve already determined that it’s out of date, and which generates a set of different outputs, that I may or may not want to perform additional tasks on.

So my question is, given this scenario, does it make sense to use the software model, creating new ComponentSpecs, BinarySpecs, SourceSets, etc. for this kind of setup that doesn’t act on source sets in the same way as java, c++, and so on? Or is it better to just custom build this? A custom LanguageSourceSet wouldn’t really be that, as it’ll contain both assets and code, all processed by the magic black box.

One additional reason I lean towards the software model, is that I do want to use buildTypes, flavors, platforms, and so on, and I’d rather not re-implement such “basic” things if I can avoid it.

In the end it all boils down to “source” that is an input to a transform that produces some output (or “binary”). The fact that the source might be a mix of a couple different types of things is mostly irrelevant. You could also potentially model it similar to how we do with the native support. As in a CSourceSet is actually a combination of source and header files, both of which are an input to the compiler.

Thanks, I’ll dig into how that is implemented a bit more. Am I right in that SourceSets are created by the various plugins, based on the ComponentType? So in this case I should write my own Default/Mutate function to attach the relevant source set types to my components? I’ve been looking at the Play plugin and that’s how it seems to be done there.

The JvmComponentPlugin and JavaLanguagePlugin might be a better example as the Play stuff is pretty complex.