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 comparison 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.
When task options that have unsupported option values, will throw an Exception pointing to the wrong assigned option value and hints what values are supported.
- Add a task validator that validates a string property has a legal value at execution time.
- A reasonable error message is provided when user specified an illegal value for an enum property from the command-line.
- A reasonable error message is provided when user specified an illegal value for an string property from the command-line.
- A reasonable error message is provided when a string property is configured with an illegal value in the build script.
The user can run gradle init --type java-lib
instead of gradle init --type java-library
- Use camel-case matching for a commandline property that accepts an enum type
- Use camel-case matching for a commandline property that accepts an string type
- Error message for illegal enum value includes candidate matches
- Error message for illegal string value includes candidate matches
- Use NameMatcher in commandline configuration.
- Add
@OptionValues
annotations for the options onDependencyInsightReportTask
- Add
@OptionValues
annotations for the options onDependencyReportTask
- Add
@OptionValues
annotations for the options onHelp
- 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
- Collection of any supported scalar type
- Conversion to
File
- Conversion to
Number
or subclass
- 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
@Option
accepts varargs or a Collection type as parameter, allow the command-line option to be specified multiple time on the command-line. - Output of
gradle help --task x
provides link to task documentation. - Remove the 'chrome' from the output of
gradle help
and other command-line tasks. - Remove the
implicitTasks
container from Project.