CollectionPropertySpec.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Fix collection property implementations when `add()` or `put()` are called when the convention is being used.

  1. … 5 more files in changeset.
Add `convention()` method for all property types with overloads that accept either the convention value or a provider of the convention value.

  1. … 19 more files in changeset.
Change `ObjectFactory` to create collection and map properties whose initial value is an empty collection or map, and add a `convention()` method for collection properties. The "convention" for a property is the value to use when none has been explicitly specified for the property. This changes adds this for collection properties for now. It will be added for all lazy types later.

  1. … 30 more files in changeset.
Prevent adding elements to the collection properties when no value

  1. … 1 more file in changeset.
Finalize the value of any task `@Input` property whose getter returns a property instance, at the start of execution of the task.

This means that the property value will not change once the task has started execution, so that the same value is always used during fingerprinting, cache key calculation, validation, when queried by a task action, and so on.

This behaviour only applies to `@Input` properties in this commit. This was just a place to start. Other properties will be added in later commits.

Changes to the property are ignored once the value is finalized implicitly in this way and generate a deprecation warning instead of failing, as would happen after `finalizeValue()` is called. This allows a migration path for task types that can add a new property to represent some input and keep their existing lenient (but now deprecated) behaviour for an existing property backed by the new property. It might prove better to flip this around, let's see.

  1. … 61 more files in changeset.
Add `HasMultipleValue.finalizeValue()` method to allow the value of a collection property to be made final. Attempts to change the property value after this method is called will fail.

Use this in the native plugins and remove the internal `LockableCollectionProperty` implementation as it is no longer needed.

  1. … 19 more files in changeset.
Fix the collection property implementations so that they track the producer tasks of each of the elements of the collection.

This allows, for example, these types to be used to model buildable collections of files or directories or to represent task inputs.

  1. … 7 more files in changeset.
Change `ObjectFactory` so that it creates list and set properties with no initial value, rather than with an empty collection as the initial value.

Added an `empty()` method as a convenience to use when constructing these kinds of properties.

    • -58
    • +128
    ./CollectionPropertySpec.groovy
  1. … 30 more files in changeset.
Move provider and property types from base-services up to model-core project. This better reflects their role and also later allows these types to reference other public types that are more specialized than those in base-services.

    • -0
    • +462
    ./CollectionPropertySpec.groovy
  1. … 101 more files in changeset.