DefaultConfigurationPublicationsTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Use the `DomainObjectCollectionFactory` everywhere

    • -5
    • +3
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 39 more files in changeset.
Use the `DomainObjectCollectionFactory` everywhere

    • -5
    • +3
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 39 more files in changeset.
Allow the services required by a given class to be queried prior to creating any instances of that class. Use this to allow `ArtifactTransformDependencies` to be injected into artifact transforms using any of the service injection patterns (that is, via a constructor or a getter).

    • -1
    • +1
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 127 more files in changeset.
Replace most direct usages of `DirectInstantiator` with indirect usages via `InstantiatorFactory` or test fixtures instead. This means more consistent behaviour in unit tests because the objects under test will behave more similarly to how they do at runtime. This also allows the decision of how the instantiation should behave to live in as few places as possible, so this can be more easily evolved and contextualized.

    • -2
    • +2
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 60 more files in changeset.
Decorate all domain collection container for emitting build ops (#7876)

* Update all domain object container with decorator for tracing executed callback actions

* Add decorator to a ll required occurances of DefaultDomainObjectSet

* Keep ctor for DefaultPolymorphicDomainObjectContainer as its used in gradle-idea-ext plugin

* Bring back DefaultDomainObjectSet constructor used by the android plugin

* keep backwards compatibility

    • -3
    • +4
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 122 more files in changeset.
Split off value snapshotting and attributes related methods of TestUtil

    • -2
    • +2
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 64 more files in changeset.
Replace `CapabilitiesExtension` with outgoing variants DSL

This commit replaces the need for a `CapabilitiesExtension` by adding the declaration

of variant capabilities on outgoing configuration variants. Instead of:

```

capabilities {

api 'org.test:foo:1.0'

}

```

one should now write:

```

configurations.api.outgoing {

capability 'org.test:foo:1.0'

}

```

    • -2
    • +5
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 24 more files in changeset.
DefaultConfiguration performance improvement: create sets lazily

    • -1
    • +1
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 3 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.

    • -2
    • +2
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 18 more files in changeset.
Improved the 'no matching variant' and 'too many matching variant' error messages to use a better description of each of the variants, such as which project/module and configuration the variant belongs to.

Made a bunch of changes to forward the display name of the variant from where the variant originates from through to the variant selection logic so it can construct the error messages, using `Describable` to represent the display name.

    • -3
    • +21
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 34 more files in changeset.
Changed the contract of `ConfigurationPublications` so that an implicit variant is always defined when the configuration has any artifacts associated with it, including inherited artifacts. Previously, the artifacts were ignored if any variants were defined.

This change allows a plugin to offer a backwards compatible 'default' variant by attaching artifacts to the configuration and define additional variants using the explicit mechanism.

    • -16
    • +138
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 9 more files in changeset.
Unify attribute modification API

Unified API for through shared interface (HasConfigurableAttributes):

- Configuration

- ConfigurationVariant

- ArtifactView

This removes convenience methods from all three interfaces in

favor of a unified API that uses strongly typed attributes.

    • -1
    • +2
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 29 more files in changeset.
Rework caching of `ImmutableAttributes`

This commit completly reworks the storage of attributes and immutable attributes. At the root of

the change is the `ImmutableAttributesFactory`, which is used to create, combine and cache

immutable attribute sets. This factory lives at the build scope level, and does *not* use a `Map`

to represent attributes. Instead, it creates a "tree" of attributes, which are mutated by adding

a new attribute. This dramatically reduces the memory pressure caused by the creation of immutable

attributes, as long at the set of attributes and values is small (which should be the case).

It's worth noting that the factory is not a _perfect_ cache. For example, depending on the order

of attributes, several "sets", corresponding to several "path to root" can be created. For example,

we can see `(foo, bar, baz)` and `(baz, foo, bar)`. Even if they are equivalent, there will be

2 distinct paths in the cache. This is not a problem, since equality check works, and the overhead

of de-duplicating is significant, so doesn't bring any advantage.

The commit also introduces a `lockAttributes` method on `ConfigurationInternal`, which allows

effectively locking the attribute set of a configuration, transforming it to an immutable

attribute set. This avoids, if multiple consumers ask for the configuration attributes in an

immutable form, to do the conversion several times (thus reducing the pressure again).

Last but not least, `DefaultAttributesContainer` is the mutable version of the attribute

container, and relies internally on `ImmutableAttributes`. This allows us to keep the semantics

of mutable attributes during the configuration phase (and, in particular, changes the attributes

of a configuration after the artifacts are created should be visible to the artifact attributes),

while deduplicating attributes and keeping memory usage low at the same time.

The drawback of this approach is the general complexity of the code, and having to pass the

`ImmutableAttributesFactory` along.

    • -1
    • +3
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 39 more files in changeset.
Changed `DefaultConfigurationPublications` to create its `variants` container only when required, as there are rarely any specific variants defined for a configuration.

    • -0
    • +59
    ./DefaultConfigurationPublicationsTest.groovy
  1. … 6 more files in changeset.