I plan to write custom plugin wrapping several code quality gradle plugins. The logic is simple: using this custom quality I want to enforce "default" standards for all our projects. On the other hand, I want all the wrapped plugins still to be customizable (for example, I'd like to set PMD plugin with "basic" ruleset by default, but definitely I do not want to limit anyone to add addinitional rulesets).
What is the recommended strategy to cascade the extensions?
- Should I do project.create({extension}) for all the plugins, check values if the values are set and default them (and how would I distinguish default from plugin extension and the default value set by the user?)
- Should I create myOwnExtension and set the values of the wrapped plugins extensions from this custom one?
- Is there any other way how to automatically do the cascade?
Thanks!
You could apply a plugin that uses
project.afterEvaluate
then look for the plugin programmatically and if it's applied then check for thepmd
block and configure as needed. If the plugin is not applied then apply the plugin and set the defaults for the block.Then you can see the result of the pmd plugin being configured