Expose the org.gradle.api.internal.tasks.options.Option annotation for use in user tasks


(Ramon Nogueira) #1

The @Option annotation seems to be what allows ‘–flags’ to be passed to tasks like ‘tasks’ and ‘help’. It would be cool if these were available to user-written tasks as well. Currently it doesn’t seem to be the case (import of that class from a gradle script fails) and in any case, the package is “internal”.

This could be used for customizing the execution of tasks. This is better than the current mechanisms for doing this viz. system properties and project properties, because Gradle can verify the option is valid for the task. Example use of this would be to replace the ‘test -Dtest.single=Foo -Dtest.debug=true’ mechanism with something like ‘test --single Foo --debug’.


Command line options for tasks
(Luke Daley) #2

Hi Ramon,

We do intend to move this to public API at some point, once it’s a little more mature.