OptionReaderTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 30 more files in changeset.
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 31 more files in changeset.
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 31 more files in changeset.
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 31 more files in changeset.
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 30 more files in changeset.
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 30 more files in changeset.
Introduce a service that takes care of inspecting a type for properties, methods and other metadata. This is a step towards using a single mechanism to discover these things efficiently rather than doing so in a bunch of different ways and multiple times.

In this commit, refactor `ClassInspector` into this service and add some in-memory caching. This class was already used for class generation.

Use this service directly in `ConventionAwareHelper` and remove some ad hoc static caching. This avoids inspecting a type that has just been inspected for class generation when an instance is first created.

Also use this service in `OptionsReader`. While this wasn't a performance problem, this change means more consistent behaviour in how annotations are validated and work with Kotlin and Groovy classes (over time).

  1. … 31 more files in changeset.
Add support for `@Option` attached to task properties of type `Property<T>`.

Collection properties are not yet handled, nor is `@OptionValues` attached to a task property of type `Provider<T>`.

Also, for task properties of type `List<T>`, convert the elements to the declared element type, rather than just forwarding a `List<String>`.

  1. … 13 more files in changeset.
Remove internal Option/OptionValues annotations

Resolves #6285.

  1. … 9 more files in changeset.
Polish new command line options functionality (#4052)

  1. … 15 more files in changeset.
Expose public API for defining command line options for tasks (#4040)

  1. … 41 more files in changeset.
Add a test for multiple values in an option specification.

+review REVIEW-5861

Allow specifying custom order of task options in help command output

This change was driven by the need to display more important option of build init plugin first.

  1. … 12 more files in changeset.
Replaced `ValueAwareNotationParser.describeValues()` with new method on `DiagnosticVisitor`, so that values are now collected while visiting the description for a notation parser.

  1. … 13 more files in changeset.
Some tweaks to error messages for badly formed @Options.

  1. … 3 more files in changeset.
REVIEW-3519 Move @OptionValues lookup to OptionReader to

- cache the results

- fail early on wrong used annotations

  1. … 5 more files in changeset.
REVIEW-3524 move more logic from OptionElements to NotationParser and OptionNotationParserFactory

  1. … 7 more files in changeset.
REVIEW-3521: fail when static methods and fields are annotated

  1. … 1 more file in changeset.
check setter available already when parsing option annotations on fields

  1. … 1 more file in changeset.
REVIEW-3521: use setter method to set a field value

  1. … 4 more files in changeset.
REVIEW-3521 let OptionReader accept any arbitrary object

  1. … 2 more files in changeset.
REVIEW-3510 change String[] Option.options() to String Option.option()

  1. … 13 more files in changeset.
REVIEW-3519: get rid of StaticOptionDescriptor

- add some more validation on option annotations

  1. … 9 more files in changeset.
REVIEW-3518: fail on wrong OptionValues annotated methods

- consider all values of optionValues.value()

- fix OptionReaderTest

  1. … 2 more files in changeset.
add copyright head => fix ci

  1. … 1 more file in changeset.
assert supported field type for option annotation;

- extract common methods of FieldOptionelement, MethodOptionElement to AbstractOptionelement

- validate that option name is valid

  1. … 5 more files in changeset.
move validation of valid method into MethodOptionElement

- don't hold option element in descriptor

  1. … 6 more files in changeset.
Make @option.description mandatory

- introduce OptionValidationException and use that instead of CommandLineException in OptionReader

- throw decent error message when description not set

- move OptionReaderTest to correct package

    • -0
    • +240
    ./OptionReaderTest.groovy
  1. … 8 more files in changeset.