attributes

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
This is a follow up on #10004

It missed one code path for the translation of values, resulting in some

issues for kotlin projects attempting to publish resolved version to

Ivy.

    • -0
    • +16
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 1 more file in changeset.
Proper transformation of deprecated usage values

This is a follow up on #10004

It missed one code path for the translation of values, resulting in some

issues for kotlin projects attempting to publish resolved version to

Ivy.

    • -0
    • +16
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 1 more file in changeset.
Replace most usages of `NamedObjectInstantiator.INSTANCE` with injection of a global service instead. This allows the instantiator to be contextualized, for example to handle caching of the generated types.

    • -2
    • +2
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 25 more files in changeset.
Replace most usages of `NamedObjectInstantiator.INSTANCE` with injection of a global service instead. This allows the instantiator to be contextualized, for example to handle caching of the generated types.

    • -2
    • +2
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 27 more files in changeset.
Replace most usages of `NamedObjectInstantiator.INSTANCE` with injection of a global service instead. This allows the instantiator to be contextualized, for example to handle caching of the generated types.

    • -2
    • +2
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 27 more files in changeset.
Replace most usages of `NamedObjectInstantiator.INSTANCE` with injection of a global service instead. This allows the instantiator to be contextualized, for example to handle caching of the generated types.

    • -2
    • +2
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 27 more files in changeset.
Split off value snapshotting and attributes related methods of TestUtil

    • -2
    • +2
    ./DefaultAttributeContainerTest.groovy
    • -2
    • +2
    ./DefaultImmutableAttributesFactoryTest.groovy
    • -2
    • +2
    ./DefaultMutableAttributeContainerTest.groovy
  1. … 62 more files in changeset.
Fix concat for attributes with same name, different type

When 2 containers contain attributes with the same name and different

types, the `concat` and `safeConcat` methods of `ImmutableAttributesFactory`

now treat these attributes as equal for the purposes of merging.

Previously, these methods would produce an `AttributeContainer`

containing both attributes.

This was a violation of the `AttributeContainer` contract which states:

"It is not allowed to have two attributes with the same name but

different types in the container"

    • -0
    • +30
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 2 more files in changeset.
Add test coverage for attribute merging

    • -0
    • +29
    ./DefaultImmutableAttributesFactoryTest.groovy
Revert "Revert "Speed up attribute matching""

    • -3
    • +6
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 14 more files in changeset.
Revert "Speed up attribute matching"

    • -6
    • +3
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 14 more files in changeset.
Make ImmutableAttributes more efficient

Keep the mapping from attribute to value in a map

instead of going up the parent chain on every request.

This is faster since attributes are queried much more

often than they are created and creation is de-duplicated,

so there are only a few such attribute containers in the

whole build.

    • -3
    • +6
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 8 more files in changeset.
Improve attribute matching across build boundaries to also work correctly for values created using `ObjectFactory.named()`.

    • -3
    • +2
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 21 more files in changeset.
Added query methods to `ImmutableAttributes` to allow the value of an attribute to be queried as an `AttributeValue` without eagerly unpacking the value of the attribute.

This is just a restructure, the value is still eagerly unpacked in the query method in this change.

    • -23
    • +1
    ./DefaultAttributeContainerTest.groovy
    • -2
    • +44
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 7 more files in changeset.
Retain the value of a variant attribute as an isolated value, rather than retaining the original value. Attribute values are snapshot at the point where the attribute is registered and are isolated from further changes to the original value.

This change allows attribute matching to more safely happen in parallel and means that attribute values can behave more consistently with other features that use isolated and snapshot values, such as task inputs or artifact transforms.

    • -5
    • +2
    ./DefaultAttributeContainerTest.groovy
    • -3
    • +6
    ./DefaultImmutableAttributesFactoryTest.groovy
    • -1
    • +2
    ./DefaultMutableAttributeContainerTest.groovy
  1. … 16 more files in changeset.
Added some unit test coverage for `DefaultImmutableAttributesFactory`.

    • -11
    • +31
    ./DefaultImmutableAttributesFactoryTest.groovy
Removed some production methods that are used only by tests.

    • -79
    • +30
    ./DefaultImmutableAttributesFactoryTest.groovy
  1. … 4 more files in changeset.
Limit the type of attributes to types we can make immutable

This commit restricts the possibilities of custom types for attributes. Since attributes are used in various

places, potentially different classloaders or even different process, we need a stable way to make them

both snapshottable and serializable. This commit is the first step, by making it impossible to create attributes

with arbitrary types.

Types that we support include:

- scalar types, which are primitive types (and their wrappers), `File` or `String` (aka, known immutables)

- a type extending `Named`, in which case it is expected to create values using the `ObjectFactory`

- an enum

- an array of the above (arrays are not immutable, but we can create immutable values out of arrays)

Some tests had to be adjusted, because they didn't match those constraints. Future work will include possibilities

to include richer types.

    • -1
    • +1
    ./DefaultAttributeContainerTest.groovy
  1. … 5 more files in changeset.
Moved some classes from 'core' to 'dependencyManagement' to live with related classes.

    • -225
    • +0
    ./DefaultAttributesSchemaTest.groovy
    • -141
    • +0
    ./DefaultCompatibilityRuleChainTest.groovy
    • -134
    • +0
    ./DefaultDisambiguationRuleChainTest.groovy
  1. … 27 more files in changeset.
Decoupled the interfaces that are used for attribute matching from the public APIs for defining the compatibility and disambiguation rules. Also changed matching so that we short-circuit evaluation of the rules when the consumer and producer values are equal, rather than doing this at the end of the chain. This means a compatibility rule cannot mark 2 equals values as incompatible, which is probably a good thing.

    • -10
    • +39
    ./DefaultAttributesSchemaTest.groovy
  1. … 14 more files in changeset.
Changed attribute matching to chain the producer's rules after the consumer's rules, rather than stopping at the end of the consumer's rules. This allows the consumer to reuse the producer's rules but override certain decisions, and it allows the producer to add new values for an attribute that the consumer knows about which are compatible with the consumer value.

    • -97
    • +39
    ./DefaultAttributesSchemaTest.groovy
    • -4
    • +4
    ./DefaultCompatibilityRuleChainTest.groovy
    • -4
    • +4
    ./DefaultDisambiguationRuleChainTest.groovy
  1. … 21 more files in changeset.
Test fixes.

    • -46
    • +1
    ./DefaultAttributesSchemaTest.groovy
  1. … 2 more files in changeset.
Added some initial support to honour the producer's schema when selecting a particular variant of something.

    • -8
    • +27
    ./DefaultAttributesSchemaTest.groovy
  1. … 18 more files in changeset.
Changed the relationship between `DefaultAttributesSchema` and `ComponentAttributeMatcher`, so that the consumer and producer schemas are first merged into a single 'effective schema' which is then passed to the matcher, and which describes a combined view of the attribute matching.

This will allow caching of matches to be applied based on the effective schema schema, which is almost always the same across all projects in the build (and builds within a composite), but also deal with the case where the producer may have a different view of the world to the consumer. This caching isn't present yet.

    • -2
    • +81
    ./DefaultAttributesSchemaTest.groovy
  1. … 10 more files in changeset.
Use the same instantiation infrastructure for attribute rules as is used for artifact transforms and other types. This change means that attribute rule constructors now need to be annotated with `@Inject`.

    • -1
    • +5
    ./DefaultCompatibilityRuleChainTest.groovy
    • -1
    • +5
    ./DefaultDisambiguationRuleChainTest.groovy
  1. … 12 more files in changeset.
Added some unit test coverage.

    • -0
    • +31
    ./DefaultCompatibilityRuleChainTest.groovy
    • -0
    • +28
    ./DefaultDisambiguationRuleChainTest.groovy
Allow configuration to be injected into attribute compatibility rules and disambiguation rules, using the same pattern as worker actions and artifact transforms.

  1. … 12 more files in changeset.
Added some context to error messages when a user provided compatibility rule or disambiguation rule fails.

    • -0
    • +106
    ./DefaultCompatibilityRuleChainTest.groovy
    • -0
    • +102
    ./DefaultDisambiguationRuleChainTest.groovy
  1. … 6 more files in changeset.
Changed the API to define an attribute compatibility rule or attribute disambiguation rule, so that a `Class<T>` is provided rather than an instance of `T`, and instances are created as they are required.

This change means that these rules may be run safely in parallel and the results are cacheable (at least, according to our definition of these things). These things don't happen yet, any more than they used to. This change simply reworks the API so that these things can be applied later.

    • -11
    • +23
    ./DefaultAttributesSchemaTest.groovy
  1. … 13 more files in changeset.
Fixed overriding of parent attributes in `DefaultMutableAttributeContainer`.

    • -0
    • +57
    ./DefaultMutableAttributeContainerTest.groovy
  1. … 3 more files in changeset.