What are the benefits of extending LanguageSourceSet

I’m currently looking into migrating the Asciidoctor Gradle plugin to use the new model. Part of this migration involves creating a new source set type, representing the Asciidoc source files.

Gradle 2.11 now allows plugin authors to extend LanguageSourceSet in managed interfaces, which sounds like a good fit. However, the release notes don’t explain why this is beneficial. So why is it worth using LanguageSourceSet as opposed to creating an independent managed interface for the custom source set?

From what I’ve gathered so far, the main benefit is that SourceSets are “understood” by the software model, and by extending them you let people work with a familiar syntax, and you can take advantage of built-in features. I have however only dabbled in this for a little while myself, so I’m sure I haven’t explored all the features yet.

By extending LanguageSourceSet you are able to filter on you own kind of sources, even if some other plugin adds default source sets to your components. component.getSources().withType(MyLanguageSourceSet) {// stuffs }

Thanks for your response. I have a better understanding of this now. The main advantage seems to be that you can use it with a managed interface. If you don’t extend LanguageSourceSet, you miss out on a lot of features such as non-property methods (e.g. includes()). And as you say, users get the same syntax regardless of the type of the source files.

You could probably do the same thing with non-managed objects instead, but that seems like a lot more work and completely undocumented. My current recommendation is that if you have the concept of a source set and want to use the new software model, you require a minimum Gradle version of 2.11.