When developing a Gradle plugin, is it possible to give some information to the apply() method except of setting some project property before applying the plugin? e. g. https://github.com/stevesaliman/gradle-properties-plugin/blob/master/src/main/groovy/net/saliman/gradle/plugin/properties/PropertiesPlugin.groovy uses two property names that could easily clash with existing property names. I’d like to make those property names configurable. But adding a convention object is probably worthless, as you would first have to apply the property to have the convention object to manipulate and then the apply method is already through. Is there any clean gradle-like way to solve this?
The only two things that come to my mind right now are to either set a project property before applying the plugin or to add another plugin that adds the convention object and then first this plugin has to be applied, then the convention object configured and then the main plugin applied. But I hope for a better option I don’t see.
If there is no clean way, I’d like to suggest a change in Gradle, that allows to give parameters to the apply method when applying a plugin, something like
apply plugin: ‘properties’, parameters: [‘foo’, ‘bar’]
which will not invoke the “apply(Project)” method in the plugin, but an apply method with more parameters.