command line options & task configuration
- User selects the dependency criteria to run dependency reports for.
- User selects which tests to include/exclude for test execution.
- User requests that tests be executed with debugging enabled.
- User specifies which Gradle version to perform an upgrade comparision build against.
- User specifies which Gradle version the wrapper should use.
State of things now: There's an internal @CommandLineOption(options='theOption', description='some description')
annotation that:
- Makes
theOption
usable on command line via--theOption
- Works only with Strings and booleans setters (e.g.
setTheOption()
), which are annotated with@CommandLineOption
Nice messages when user incorrectly uses a command line option.
- all acceptance criteria
- works if there are extra unrelated, non-configurable tasks
- works in a multi-project build
- None of the potential user mistakes listed below should lead to an internal error.
- Current command line options are not handled consistently at the moment. For example, --offline works same as -offline, but --ofline (typo) does not work the same as -ofline
- Fix issue where an unknown option leads to an internal error.
- Nice error reporting for:
- misspelled option(s).
- options required but not provided.
- option needs a value (e.g. String) but none provided.
- options that must not have value (e.g. boolean options) but value was provided
- single '-' used instead of '--'
- option used but there are no tasks that accept this configuration option
- clashing options, e.g. no-value boolean option in one task is a string option in other task
- When a value has not been specified for a required task property and that property has a
@CommandLineOption
annotation, then the validation error message should inform the user that they can use the specified option to provide a value.
TBD
TBD
- Make sure we're happy with the notation. Current one is:
some_task some_configurable_task --some_option --some_option2 optional_option2_value some_other_task
I'm worried that without some kind of namespacing we'll run into problems in the long run. - Move the
@CommandLineOption
annotation to the public API and mark@Incubating
. - Add documentation to 'implementing custom tasks` chapter.
- Use
NotationParser
to convert from command-line option to method parameter type. - Support annotating a Groovy task field.
- Support multiple values for
CommandLineOption.options()
or replaceoptions()
with singularoption()
. - Support zero args methods annotated with
@CommandLineOption
. - Add validation for methods with
@CommandLineOption
:- The method must take exactly zero or one parameters.
- The parameter must be of type boolean or assignable from String or assignable from Boolean.
- Add error reporting for:
- Configuration method throws an exception.
- Annotation is missing 'options' value.
- Annotation is missing 'description' value.
Add some command line interface for discovering available command-line options.
Running gradle --help test
shows a usage message for the test
task.
The resolution message (ie the *Try: ....
console output) for a problem configuring tasks from the command-line options should suggest that the user
run ${app-name} --help <broken-task>
or ${app-name} --help
TBD
TBD
TBD
TBD
- Add option to
DependencyReportTask
to select the configuration(s) to be reported on. - Add option to
Test
task to select which tests to include, which tests to exclude, and whether to run with debugging enabled. - Probably more - see use cases above.
The reference page for a task type should show which command-line options are available for the type.
TBD
TBD
TBD
TBD
- Figure out what to do if multiple tasks of different types are selected and there are clashing command line options. For example, 'foo' option that requires a string value in one task type but is a boolean flag in some other task type. This is not a blocker because we have very little command line options, yet.
- Decide on precedence order if task is configured from the command line and in the build script. Add coverage, etc.
- If a method marked with
@CommandLineOption
accepts varargs or a Collection type as parameter, allow the command-line option to be specified multiple time on the command-line. - Add support for more types in the conversion from command-line option value to property value, in particular File.