DefaultResolvedArtifactTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Fixes for previous commit.

  1. … 4 more files in changeset.
Fixes for previous commit.

  1. … 4 more files in changeset.
Treat the artifacts produced for a local file dependency and those produced for other kinds of dependencies more similarly, when visiting the result.

Specifically, merge `ArtifactVisitor.visitFile()` into `ArtifactVisitor.visitArtifact()`, so that now all files/artifacts that participate in the resolution result are represented as a `ResolvableArtifact`.

  1. … 34 more files in changeset.
Treat the artifacts produced for a local file dependency and those produced for other kinds of dependencies more similarly, when visiting the result.

Specifically, merge `ArtifactVisitor.visitFile()` into `ArtifactVisitor.visitArtifact()`, so that now all files/artifacts that participate in the resolution result are represented as a `ResolvableArtifact`.

  1. … 21 more files in changeset.
Treat the artifacts produced for a local file dependency and those produced for other kinds of dependencies more similarly, when visiting the result.

Specifically, merge `ArtifactVisitor.visitFile()` into `ArtifactVisitor.visitArtifact()`, so that now all files/artifacts that participate in the resolution result are represented as a `ResolvableArtifact`.

  1. … 21 more files in changeset.
Treat the artifacts produced for a local file dependency and those produced for other kinds of dependencies more similarly, when visiting the result.

Specifically, merge `ArtifactVisitor.visitFile()` into `ArtifactVisitor.visitArtifact()`, so that now all files/artifacts that participate in the resolution result are represented as a `ResolvableArtifact`.

  1. … 34 more files in changeset.
Moved some logic that decides whether or not to resolve an artifact synchronously or asynchronously into the implementation of the artifact, to move it closer to the code that is in a better position to know this.

  1. … 5 more files in changeset.
Added a new type `ResolveableArtifact` to use instead of public `ResolvedArtifact` when resolving and visiting the artifacts of a dependency resolution result.

    • -0
    • +15
    ./DefaultResolvedArtifactTest.groovy
  1. … 29 more files in changeset.
Attempt to resolve an artifact only once per configuration (including all views of the configuration). If the resolution fails, collect the failure and rethrow when queried again later.

    • -0
    • +55
    ./DefaultResolvedArtifactTest.groovy
  1. … 4 more files in changeset.
Removed `ResolvedArtifact.getAttributes()` as they are no longer used, and should not have been included on this type.

  1. … 9 more files in changeset.
Address review feedback in depmanagement build operation instrumenting

- let BuildOperationExecuter deal with failures

- tweak build operation display names

- move BuildOperation decorating from DefaultResolvedArtifact to DefaultArtifactSet

+review REVIEW-6432

  1. … 7 more files in changeset.
Add build op for each file artifact resolution

  1. … 16 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. … 39 more files in changeset.
Improve efficiency of `ImmutableAttributes`

This commit reduces the number of calls to `asImmutable()` and makes `asImmutable()` always return

an `ImmutableAttributes` instance. This allows us to optimize several cases, like copy or concatenation

of immutable attributes.

  1. … 18 more files in changeset.
Fix constructor call in test

Further changes to ensure the build dependencies of artifacts travel with the artifacts themselves through the resolution pipeline.

Changed `ArtifactSet` to produce a `ResolvedArtifactSet` rather than a set of artifacts and a separate set of build dependencies. Changed `ResolvedArtifact` so that it carries the build dependencies of the artifact with it. One side effect of this change is that excluded local artifacts are no longer built.

    • -10
    • +9
    ./DefaultResolvedArtifactTest.groovy
  1. … 21 more files in changeset.
Revert De-duplicate commonly used immutable objects in dependency resolution and IDE changes

Commits reverted:

- 807b1e4f8d1585d93c1de3e9ca83d99d0819e2d2

- 9482b0b05374253cafdb776550d7016385912e04

- 4ecead06b53ec6b0f15c517bf0d0c6a74c3b3c05

- db1135a8a5f1c507e0df3c03ad12ddc963799e4d

- 7350bcbae30a777909cec74ebfd5a91d2c89081e

Additionally, minor changes to avoid usage of introduced

classes and methods from subsequent commits.

Issue: gradle/gradle-private#563

  1. … 109 more files in changeset.
De-duplicate (= intern) some instances in dependency resolution

- Reduce memory usage of dependency resolution by de-duplicating the

most commonly used immutable instances.

- Objects aren't strictly immutable: displayName is calculated lazily

- solution is thread-safe without synchronization

- lazy calculation is needed for efficient interning since a lookup

will always create a new instance.

- Use strong references in some instance interners

- strong references cause less GC overhead than weak references

- Strong references:

DefaultModuleIdentifier

DefaultModuleVersionIdentifier

DefaultModuleVersionSelector

DefaultModuleComponentIdentifier

DefaultModuleComponentSelector

DefaultProjectComponentSelector

- Weak references:

DefaultLibraryBinaryIdentifier

DefaultLibraryComponentSelector

DefaultIvyArtifactName

- Both reference types:

DefaultBuildIdentifier

DefaultProjectComponentIdentifier

- The reason for special handing is that DefaultBuildIdentifier

has a state field "current" as part of the instance which

isn't part of equals/hashCode.

+review REVIEW-6277

  1. … 104 more files in changeset.
GRADLE-3362: Fix equality for DefaultResolvedArtifact

Gradle 2.5 involved a major rework of dependency resolution, including

removing the use of Ivy ModuleDescriptor to represent local project artifacts

in dependency resolution. This rework introduced a bug, where resolved artifacts

were being compared based on their `IvyArtifactName`, which is not guaranteed

to be unique for every `PublishArtifact`: the uniqueness breaks down when

a custom `archiveName` is provided for an `AbstractArchiveTask` instance.

This change fixes equality for `DefaultResolvedArtifact`, so that it uses the

unique `ComponentArtifactIdentifier` to for artifact comparison. This fixes

GRADLE-3330 and GRADLE-3362.

+review

  1. … 2 more files in changeset.
Introduce ResolverResults#getResolvedArtifacts

+review REVIEW-5515

  1. … 40 more files in changeset.
Further detangling of Graph and Artifact resolution

  1. … 23 more files in changeset.
Moved some meta-data types out of org.gradle.api.internal.artifacts to org.gradle.internal.component, and split up into base, local and external types.

  1. … 307 more files in changeset.
Renamed subprojects/core-impl to subprojects/dependency-management.

    • -0
    • +48
    ./DefaultResolvedArtifactTest.groovy
  1. … 1384 more files in changeset.