DependenciesMetadataAdapterTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Remove wrong test

This test has no value as the dependencies are GradleDependencyMetadata, not the ones we added the API to.

Signed-off-by: Benjamin Muskalla <bmuskalla@gradle.com>

    • -9
    • +0
    ./DependenciesMetadataAdapterTest.groovy
Rework API to expose selectors

This allows to expose metadata for multiple artifacts.

Selectors are now also exposed for Ivy components.

Signed-off-by: Benjamin Muskalla <bmuskalla@gradle.com>

    • -3
    • +2
    ./DependenciesMetadataAdapterTest.groovy
  1. … 5 more files in changeset.
Add accessors for sourced attributes within metadata rules

If a component metadata rule needs to rewrite dependencies

based on either the original maven pom classifier or type,

these are now exposed on the dependencies within the metadata

rule.

Fixes #11975

Signed-off-by: Benjamin Muskalla <b.muskalla@gmail.com>

    • -0
    • +18
    ./DependenciesMetadataAdapterTest.groovy
  1. … 5 more files in changeset.
Rename inheritStrictVersions() -> endorseStrictVersions() (#10755)

This name change more clearly communicates the semantics of the

feature from a users point of view.

This commit also removes all mentions of 'inheriting' AND 'forSubgraph'.

There have been some leftovers in documentation/comments that

would have been misleading in the future. To make sure we catch all,

this also updates all variable/method/package names.

    • -6
    • +6
    ./DependenciesMetadataAdapterTest.groovy
  1. … 70 more files in changeset.
Updates to terminology for clarity

- `inheritStrictConstraints` -> `inheritStrictVersions`

- `notInheritStrictConstraints` -> `doNotInheritStrictVersions`

    • -2
    • +2
    ./DependenciesMetadataAdapterTest.groovy
  1. … 31 more files in changeset.
Rework `forSubgraph` as implied by `strictly`

This commit removes a dedicated `forSubgraph` flag

on version constraints, so that it is _implied_ by

strict version constraints. This simplifies the behavior

of `strictly`, making it closer to the intuitive semantics,

while maintaining the ability to fail the build if a

consumer brings an incompatible version in the graph.

As a consequence, _strict dependencies_ now express that

the producer preference overrides whatever is found in

its own dependency graph. It is closer to the "nearest

first" semantics of Maven, while not having its drawbacks

(ordering in particular).

    • -2
    • +2
    ./DependenciesMetadataAdapterTest.groovy
  1. … 77 more files in changeset.
Test dependency modification against all three metadata implementations

    • -3
    • +4
    ./DependenciesMetadataAdapterTest.groovy
  1. … 3 more files in changeset.
Add support for constraint inheritance to component metadata rules

    • -2
    • +23
    ./DependenciesMetadataAdapterTest.groovy
  1. … 13 more files in changeset.
Introduce constraint inheritance API

    • -1
    • +1
    ./DependenciesMetadataAdapterTest.groovy
  1. … 40 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
    ./DependenciesMetadataAdapterTest.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.

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

    • -2
    • +2
    ./DependenciesMetadataAdapterTest.groovy
  1. … 64 more files in changeset.
Use `require` instead of `prefer` in more tests

    • -3
    • +3
    ./DependenciesMetadataAdapterTest.groovy
  1. … 11 more files in changeset.
Import POM files as different variants

This commit implements solution 6 of #4422, by importing POM files

using different variants. By default, a POM file will be imported

as 6 different variants:

- 2 libraries (runtime and compile)

- 4 platforms (runtime and compile, regular and enforced)

This implies that a dependency on a BOM will now be intepreted as

a dependency on a library, whereas a dependency on a BOM expressed

using the `platform(...)` or `enforcedPlatform(...)` methods will

be interpreted as importing the platform component published at

the same coordinates.

This commit doesn't remove optional dependencies for Maven, but

reimplements how the dependencies are shuffled in different variants.

The dependencies found in a dependency management block are no

longer considered optional. Instead, they are properly marked as

constraints. However, they are only visible if using the experimental

flag, **and** using the platform variant.

    • -1
    • +1
    ./DependenciesMetadataAdapterTest.groovy
  1. … 31 more files in changeset.
Rename 'DependencyMetadata.isPending()` -> `isConstraint()`

    • -1
    • +1
    ./DependenciesMetadataAdapterTest.groovy
  1. … 22 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
    ./DependenciesMetadataAdapterTest.groovy
  1. … 164 more files in changeset.
Intern strings when reading module metadata from cache

Dependency resolution of large dependency graphs involves a significant

number of comparisons of strings(group, artifact, version, ...). Most of

those come from the module metadata cache, and even if we use hashmaps,

we still need to perform `equals` comparisons on strings, when in most

of the cases they should be identical. This commit takes advantage of

knowing that to add a cost when we read module metadata (interning), but

realizing that the debt is paid when comparing strings during resolution.

The interner is build scoped (in order to avoid memory leaks), thread-safe,

and shared with the dependency notation converter, so that module selectors

created from strings found in the build scripts are using the same strings

as the ones from the module metadata cache.

Ideally, we should also do this for the strings used during parsing.

    • -1
    • +2
    ./DependenciesMetadataAdapterTest.groovy
  1. … 17 more files in changeset.
Move attributes from dependency metatada to component selector

This commit changes the location where attributes on dependencies are defined, making

them effectively part of the _module component selector_. It's cleaner as it effectively

belongs to the selector state: attributes participate in the selection like group, name

and version.

It will also make module metadata serialization consistent.

    • -4
    • +3
    ./DependenciesMetadataAdapterTest.groovy
  1. … 27 more files in changeset.
Support mutating dependency attributes via component metadata rules

This commit allows mutating attributes of module dependencies via component metadata rules.

Even if a published module doesn't declare any attribute on a dependency, it is now possible

to mutate the module metadata so that dependencies have attributes, which would then be used

in dependency resolution.

    • -2
    • +22
    ./DependenciesMetadataAdapterTest.groovy
  1. … 22 more files in changeset.
Add reason to `DependencyMetadata`

This allows propagating reasons from `Dependency` to `DependencyMetadata`, which in turn can be used

as `ComponentSelectionReason` descriptions. Doing this lets us display the description in the dependency

insight report.

This commit, however, does **not** add support for serializing reasons, or publishing them. This means

that this only works for direct dependencies so far.

Signed-off-by: Cedric Champeau <cedric@gradle.com>

    • -1
    • +1
    ./DependenciesMetadataAdapterTest.groovy
  1. … 26 more files in changeset.
Adjust tests to changes in implementation types

    • -4
    • +20
    ./DependenciesMetadataAdapterTest.groovy
  1. … 3 more files in changeset.
Renamed `DefaultDependencyMetadata` -> `ExternalDependencyDescriptor`

This type now represents the external representation of a dependency, not the

internal `DependencyMetadata`. Also renamed and polished Ivy/Maven subtypes.

    • -3
    • +2
    ./DependenciesMetadataAdapterTest.groovy
  1. … 34 more files in changeset.
Don't use Ivy abstractions to compose MavenDependencyMetadata

The Ivy descriptor format has pervaded our design for too long.

Ivy begone!

    • -1
    • +1
    ./DependenciesMetadataAdapterTest.groovy
  1. … 9 more files in changeset.
Support modification of strict dependencies in component metadata rules (#3511)

We also adjust the Gradle build to the change in the DependencyMetadata

interface temporarily and support both variants of the interface.

    • -3
    • +3
    ./DependenciesMetadataAdapterTest.groovy
  1. … 8 more files in changeset.
Remove unit test uses of DependencyMetadata.requested

    • -21
    • +21
    ./DependenciesMetadataAdapterTest.groovy
  1. … 14 more files in changeset.
Back ModuleDependencyMetadata implementations with ModuleComponentSelector

Replace the backing ModuleVersionSelector with a ModuleComponentSelector for:

- IvyBackedMetadata

- MavenBackedMetadata

- GradleBackedMetadata

Converted a few more uses of ModuleVersionSelector -> ModuleComponentSelector

    • -3
    • +4
    ./DependenciesMetadataAdapterTest.groovy
  1. … 19 more files in changeset.
Fix merge conflict

    • -1
    • +1
    ./DependenciesMetadataAdapterTest.groovy
  1. … 2 more files in changeset.
Make existing dependency modifiable in metadata rules (#3351)

This allows for modification of the version property (string notation).

    • -0
    • +40
    ./DependenciesMetadataAdapterTest.groovy
  1. … 5 more files in changeset.
Extend metadata rules to allow adjustment of dependencies

This adds:

- withVariant(variant_name) {}:

Choose an existing variant (or

configuration) by name to modify its dependencies.

This hook can later be used to modify attributes of a variant.

- withVariant(variant_name) { withDependencies {} }:

Inside the withDependencies block, existing dependencies can be

removed and new dependencies can be added.

    • -0
    • +140
    ./DependenciesMetadataAdapterTest.groovy
  1. … 34 more files in changeset.