Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Allow filtering content of a repository based on the configuration name and attributes

This effectively adds the configuration name, as well as its attributes, to the context

details, so a rule can decide to resolve differently.

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 6 more files in changeset.
Move in-memory caches to persistent-cache project

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

    • -2
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 64 more files in changeset.
Move ValueSnapshotter and friends to snapshots project

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 54 more files in changeset.
Normalize `ModuleIdentifier`

This commit reworks the `ComponentModuleIdentifier`/`ComponentModuleSelector`/`ModuleVersionSelector`

classes to use `ModuleIdentifier` under the hood, instead of storing denormalized strings. This has

the advantage that we can reduce the use of the module identifier factory, which is called very

often during dependency resolution. Sharing instances reduces the need for conversions, and makes

comparisons faster.

    • -1
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 164 more files in changeset.
Introduce `ComponentMetadataSupplierRuleExecutor`

This gives us better abilities to unit test the behavior of this specific

rule executor.

    • -2
    • +7
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 16 more files in changeset.
Introduce `ComponentMetadataSupplierRuleExecutor`

This gives us better abilities to unit test the behavior of this specific

rule executor.

    • -2
    • +7
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 16 more files in changeset.
Fix failing unit tests

    • -2
    • +4
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 13 more files in changeset.
Fix failing unit tests

    • -2
    • +4
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 13 more files in changeset.
Add initial support component metadata supplier caching

This commit adds the infrastructure for caching of component metadata rules.

For now, the only kind of rule we can cache are the component metadata supplier

rules, which are used during dynamic version selection, but the executor

infrastructure can be reused to cache more kinds of rules.

The implementation relies on the principal that a "rule" can be safely cached if:

- the rule has no side effect, and uses the "class-based pattern"

- the implementation of the rule didn't change

- the inputs of the rule didn't change

For this, we introduce a new persistent cache (hence cross-build) with an in-memory

facing cache, that allows us to avoid the execution of a rule if the result is

already in the cache. The implementation makes use of _snapshotting_ to capture the

state of the inputs of a rule, which consists of the implementation of the rule and

its potential parameters. It's worth noting that at this stage we do not consider

the services the rule can use, it's going to be done in a subsequent commit.

This worked required a clarification of what an rule cares about (the result) in

opposition to what the user is faced with. For example, a component metadata supplier

rule output is a `ComponentMetadata`, but what we offer to the user, to build that

metadata, is a `ComponentMetadataSupplierDetails` instance. Similarly, component

metadata rules would have different kind of output and what the user manipulates.

The cache works with a primary key (for the first implemented cache, the key is the

module version identifier) and will invalidate the results based on the cache policy

(should refresh modules).

The persistent cache uses the snapshot as the key in the store. In theory, should we

consider that we have a nearly perfect hash function, we could instead use the hash

of the snapshot as the key. Measurements would have to be made to check if it's worth

implementing.

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 46 more files in changeset.
Add initial support component metadata supplier caching

This commit adds the infrastructure for caching of component metadata rules.

For now, the only kind of rule we can cache are the component metadata supplier

rules, which are used during dynamic version selection, but the executor

infrastructure can be reused to cache more kinds of rules.

The implementation relies on the principal that a "rule" can be safely cached if:

- the rule has no side effect, and uses the "class-based pattern"

- the implementation of the rule didn't change

- the inputs of the rule didn't change

For this, we introduce a new persistent cache (hence cross-build) with an in-memory

facing cache, that allows us to avoid the execution of a rule if the result is

already in the cache. The implementation makes use of _snapshotting_ to capture the

state of the inputs of a rule, which consists of the implementation of the rule and

its potential parameters. It's worth noting that at this stage we do not consider

the services the rule can use, it's going to be done in a subsequent commit.

This worked required a clarification of what an rule cares about (the result) in

opposition to what the user is faced with. For example, a component metadata supplier

rule output is a `ComponentMetadata`, but what we offer to the user, to build that

metadata, is a `ComponentMetadataSupplierDetails` instance. Similarly, component

metadata rules would have different kind of output and what the user manipulates.

The cache works with a primary key (for the first implemented cache, the key is the

module version identifier) and will invalidate the results based on the cache policy

(should refresh modules).

The persistent cache uses the snapshot as the key in the store. In theory, should we

consider that we have a nearly perfect hash function, we could instead use the hash

of the snapshot as the key. Measurements would have to be made to check if it's worth

implementing.

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 46 more files in changeset.
Add support for dependency-level attributes during dynamic version selection

This commit adds support for using dependency-level attributes when resolving

dynamic versions. Similarly to configuration-level attributes, we will now

make sure that whenever a dynamic version is resolved, the attributes defined

at the dependency-level are honored.

    • -2
    • +3
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 12 more files in changeset.
Implement matching of component attributes during dynamic version selection

This commit adds support for matching the component attributes during the selection

of a version, when the selector is dynamic. Before, component-level attributes were

ignored, meaning we could select a version which wouldn't have any variant matching

the consumer attributes. With those changes, it is possible, for example, to have

a version, 1.3, which doesn't match the consumer attributes, and an earlier version,

say 1.2, which does. In that case, 1.2 would be selected instead of 1.3.

The consequence of this change is that we now have to fetch metadata for components

that are selected during dynamic version selection, in order to check if they match

the component attributes. This used to be the case for status selectors (`latest.release`)

but not for version ranges (`[1.0, )`).

It's also worth noting that if the selector is dynamic, we will perform attribute

matching at least twice (possibly with different attribute sets):

- once during version selection (for each candidate, check if its attribute match)

- then once during _variant_ selection (in which case each variant may have additional

attributes)

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 14 more files in changeset.
Remove useCache in DefaultArtifactResolutionQuery

Fix https://github.com/gradle/gradle/issues/3579

The inappropriate usage of `useCache` in DefaultArtifactResolutionQuery might cause dead lock.

This PR remove the usage of `useCache`.

Signed-off-by: Bo Zhang <bo@gradle.com>

    • -8
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 4 more files in changeset.
Rename {`forComponent` => `forModule`}

    • -3
    • +3
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 2 more files in changeset.
Introduce `ArtifactResolutionQuery#forComponent(group, name, version)`

So it can be used by `kotlin-dsl` in place of the internal

`DefaultModuleComponentIdentifier#newId`.

    • -11
    • +36
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 2 more files in changeset.
Rework range selection algorithm

This commit changes the handling of range intersection: instead of relying on restarting selection of nodes,

we now perform additional checks, when a version is encountered, to see if it is _compatible_ with an already

selected version.

Conflict resolution will kick in as last resort.

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 26 more files in changeset.
Rework intersecting ranges handling

This commit reworks the intersection range discovery handling using the

infrastructure put in place in the previous commit: instead of having

special metadata which has to be wrapped/unwrapped using a special case,

there is now a conflict resolution rule aimed at restarting selection for

a node when we see that 2 conflicting ranges are intersecting. This can

happen when a new node is added in the graph with a different range.

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 28 more files in changeset.
Fixed tests for changes to method signatures.

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

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

    • -2
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 162 more files in changeset.
Removed unused class

Apparently we only use the interfaces as filter predicates, but no

instance is ever created.

    • -2
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 1 more file in changeset.
Renamed `ResolverProvider` -> `ComponentResolvers`

    • -2
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 17 more files in changeset.
Rename RepositoryChain to ResolverProvider

+review REVIEW-5505

    • -2
    • +3
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 14 more files in changeset.
Inject a ResolutionStrategy instead of Configuration

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 4 more files in changeset.
Renamed ComponentRequestMetaData -> ComponentOverrideMetadata

    • -2
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 35 more files in changeset.
Replaced DependencyMetaData with ComponentRequestMetaData in ComponentMetaDataResolver.resolve()

- Added ComponentRequestMetaData.getClientModule()

    • -3
    • +2
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 15 more files in changeset.
A bit more detangling of DependencyToComponentIdResolver and ComponentMetaDataResolver

    • -1
    • +1
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 12 more files in changeset.
Removed DependencyToComponentResolver

- Always use DependencyToComponentIdResolver and ComponentMetaDataResolver

    • -4
    • +5
    ./DefaultArtifactResolutionQueryTest.groovy
  1. … 19 more files in changeset.