DependencySubstitutionResolverSpec.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Revert "Revert "Run dependency rules as dependencies are added to the graph""

This reverts commit 9af99b9a261b2e9f7ca98d88a3870bf31e95e436.

    • -85
    • +0
    ./DependencySubstitutionResolverSpec.groovy
  1. … 12 more files in changeset.
Revert "Run dependency rules as dependencies are added to the graph"

This reverts commit 4d423950bba9decdbdca11a6b67a915fd235244e.

Reverting due to potential performance regression.

    • -0
    • +85
    ./DependencySubstitutionResolverSpec.groovy
  1. … 12 more files in changeset.
Run dependency rules as dependencies are added to the graph

Previously, dependency rules (resolve/substitution) were applied in two

places: once when building the 'pending nodes map', and again when

resolving the dependency (DependencySubstitutionResolver).

These 2 processes have been replaced by a single process that runs any

dependency rules at the time the dependency is added to the graph.

This simplifies the code and ensures that what ends up in the graph

is always the result of executing the dependency rules.

Moved dependency substitution into one place

    • -85
    • +0
    ./DependencySubstitutionResolverSpec.groovy
  1. … 12 more files in changeset.
Removed a few unused instances of DefaultModuleVersionSelector

    • -3
    • +0
    ./DependencySubstitutionResolverSpec.groovy
  1. … 1 more file in changeset.
Use ComponentSelectorConverter to determine `ModuleIdentifier` for graph edges

Previously, we used the `ModuleVersionSelector` that travelled with the dependency

metadata in order to determine which `ModuleIdentifier` was targetted by the

dependency. With this change, we determine the module based on the selector:

- ModuleComponentSelector: Directly map module identifier from selector coordinates

- ProjectComponentSelector: Lookup target project to get coordinates

    • -1
    • +1
    ./DependencySubstitutionResolverSpec.groovy
  1. … 10 more files in changeset.
Removed unused `ModuleId` param from `DependencyToComponentIdResolver.resolve()`

    • -6
    • +5
    ./DependencySubstitutionResolverSpec.groovy
  1. … 14 more files in changeset.
Make `ModuleComponentSelector` use `ImmutableVersionConstraint`

    • -1
    • +2
    ./DependencySubstitutionResolverSpec.groovy
  1. … 8 more files in changeset.
Rename `DefaultVersionConstraint` to `DefaultMutableVersionConstraint`

... and use the immutable version whenever possible.

    • -3
    • +3
    ./DependencySubstitutionResolverSpec.groovy
  1. … 63 more files in changeset.
Adjust `Dependency` and module selection to use `VersionConstraint`

This fixes the mismatch between immutable and mutable version constraints.

    • -1
    • +1
    ./DependencySubstitutionResolverSpec.groovy
  1. … 32 more files in changeset.
Make `ModuleComponentSelector` the source of truth for version constraints

This commit pushes `VersionConstraint` as a primary concept in `ModuleComponentSelector`. It replaces the (now)

deprecated `getVersion` call, which didn't reflect all possible constraints on a version. This change has several

consequences:

- version constraints now need to be "serializable"

- version constraints now consist of a preferred version and a list of rejected versions

- only a single item in the rejection list is supported

- Gradle module metadata parsing now generates a prefer/reject list

- Gradle module metadata writing does **not** yet support writing prefer/reject

- the module metadata binary format has been bumped to support prefer/reject in module descriptors

- metadata rules can say `useTarget(VersionConstraint)`

Issue #3312

    • -2
    • +3
    ./DependencySubstitutionResolverSpec.groovy
  1. … 93 more files in changeset.
Avoid computing `ModuleIdentifier` multiple times for the same module

This commit pre-computes a `ModuleIdentifier` from a dependency and passes it around several places where it

is used. This saves a bunch of lookups in the module identifier cache, which tend to be pretty expensive.

Dependency substitution is also passed the original module identifier, in case no substitution is done. This

prevents an additional lookup.

    • -6
    • +9
    ./DependencySubstitutionResolverSpec.groovy
  1. … 23 more files in changeset.
Move application of dependency substitution into its own class

This allows separating the concern of applying a rule, which is in the new class, from selection based on

the result of the application, which is in `DependencySubstitutionResolver`. This also allows us to reuse

the logic during optional dependency handling code (even if in practice, we don't cache the result of

application on a dependency, so for optional dependencies the rule may be applied at most twice on the

same object).

    • -1
    • +1
    ./DependencySubstitutionResolverSpec.groovy
  1. … 11 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

    • -2
    • +2
    ./DependencySubstitutionResolverSpec.groovy
  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

    • -2
    • +2
    ./DependencySubstitutionResolverSpec.groovy
  1. … 104 more files in changeset.
Use build name for `ProjectComponentSelector` instead of identifier

This makes `ProjectComponentSelector` more useful across builds, since it does

not require a BuildIdentifier to be 'localized for the currently executing

build.

    • -3
    • +1
    ./DependencySubstitutionResolverSpec.groovy
  1. … 14 more files in changeset.
Provide correct name for current build id

    • -3
    • +1
    ./DependencySubstitutionResolverSpec.groovy
  1. … 15 more files in changeset.
Use `BuildIdentity` for `ProjectComponentSelector` too

    • -1
    • +4
    ./DependencySubstitutionResolverSpec.groovy
  1. … 14 more files in changeset.
Localize project dependencies that are substituted

When a substitution is performed in composite build, the project id

needs to be contextualized for the currently executing build. This

is now performed at the time of substitution, rather than much later

when were are resolving the id to a component metadata.

    • -1
    • +3
    ./DependencySubstitutionResolverSpec.groovy
  1. … 6 more files in changeset.
Rename `o.g.i.c.model.*{MetaData => Metadata}`

    • -3
    • +3
    ./DependencySubstitutionResolverSpec.groovy
  1. … 162 more files in changeset.
Moved classes related to dependency substitution into a separate package

    • -0
    • +83
    ./DependencySubstitutionResolverSpec.groovy
  1. … 28 more files in changeset.