My plugin, macAppBundle, gives warning in 4.3-rc-2 due to nulls in task.inputs.property for unset properties. The nulls are apparently now a problem and the official way to deal with these is to flag these is
I am happy to fix this. But unfortunately, the .optional() method does not exist prior to 4.3, and so I am forced to choose between a bit of a hack to avoid the warning message if I want the plugin to remain usable in both 4.3 and prior versions.
Two questions, first, is there a way for a plugin to either specify the minimum version of gradle? This would allow me to release a new version of the plugin targeting >=4.3 while also letting users who are still on older versions of gradle know that they should not upgrade the plugin. It would be nice if this were part of the official gradle plugin portal. But if not, then can I programmatically find and check the current gradle version being >= 4.3 so I can warn the user on launch? I found these two posts, but neither seems to be current, or at least the classes they reference are not in the public API docs. I guess I can use
gradle.gradleVersion, but parsing strings to find <= seems fraught with peril. And given the fact that a big part of gradle is handling dependency versioning issues, seems like I shouldn’t have to hack that together. I like the idea as suggested in the first post of a plugin saying something like:
Second question, is this even the right way to go about this? How should task InputProperties that are optional be handled in a way that does not require the latest gradle? Is
optional(true) the best way or should I use something else?