I feel that Gradle needs a better way to allow users to pass arguments to individual tasks.
At the moment this can be achieved in three different ways:
- defining to define properties via -Pmyprop=myvalue * defining JVM system properties via -Dmyprop=myvalue * handling optional arguments via a task rule (which from a usability means you get to pass one argument)
None of these are particularly great from a usability perspective.
The ideal solution (IMHO) would have been if Gradle’s own options had been restricted to only use a single dash, then double dashes (–) could have been used to pass parameters to each task in a way that most users would expect from convention (and conventions matter, right?).
However, if that is not possible to do, I realised today that task rules are indeed very flexible.
It is quite easy to introduce a new paradigm, by eg. defining a task rule around ‘+’ and then handling the remainder as a parameter, eg. +myparam=myvalue. The task rule can collect the options in a common object, similar to ext for example.
So for the time being this is the route we are going down.
But the ideal would have been something else. Is there any chance you can consider adding a way to pass command line arguments either by reworking how gradle uses “-” and “–”, or allow ‘—’ to pass arguments to a task and not go via a common global object?