ResolveTestFixture.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Improve `ResolveTestFixture` to support multiple reasons

The resolve test fixture only took the last "description" into consideration. This makes it hard to write tests for custom dependency

reasons. Also, the output of the comparison wasn't very developer friendly, because it was showing the internal, stringy, representation

of the dependency graph nodes.

This commit improves everything by not relying on string comparisons anymore to compare the components. Edges are still compared using

strings, but it already makes things much easier to reason about.

Rework component selection reason to support composite explanations

This commit changes how `ComponentSelectionReason` works, so that we can save a list of selection

reasons, instead of a single one. This should let us give richer explananations about why a component

was selected. In particular, a component may be selected because another one was rejected, or it

can be selected by a rule **and** by conflict resolution. This last case was handled in an adhoc

manner, it's now a regular case.

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

  1. … 41 more files in changeset.
Remove `ResolvedNamedVariantResult`

This commit removes the "named" version of the resolved variant resolution result

in favor of a `getDisplayName()` method directly on `ResolvedVariantResult`.

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

  1. … 10 more files in changeset.
Update test to show the resolved result gives access to the target variant attributes

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

  1. … 2 more files in changeset.
Add support for showing the resolved variant and its attributes in `ResolvedComponentResult`

This commit adds a `ResolvedNamedVariantResult getVariant()` method on `ResolvedComponentResult`,

which gives access to the resolved variant details. In practice, the details are currently limited

to:

- the name of the variant

- the attributes attached to this variant

The attributes are desugared: if the original variant had strongly-typed attributes, what we get

by the result of this call is an attribute container where all attributes are of type `String`.

As a consequence, it should only be used for diagnostics.

The `ResolveTestFixture` has been adjusted so that we can now (optionally) check the selected

variant and its attributes. One test has been adjusted to check the variant.

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

  1. … 25 more files in changeset.
Add test to show that custom reason for dependency substitution is available in resolution result

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

  1. … 1 more file in changeset.
Let Maven and Ivy module fixture provide java library variants

  1. … 8 more files in changeset.
Rename 'isCompositeParticipant' to 'isCompositeSubstitution'

  1. … 2 more files in changeset.
Tweak ComponentSelectionReason interface

- rename isCompositeBuild -> isCompositeParticipant;

- tweak javadoc

Signed-off-by: Rene Groeschke <rene@gradle.com>

  1. … 2 more files in changeset.
Expose composite build explicitly as ComponentSelectionReason

* to have stronger api to detect composite build as selection reason

just relying on the description method is not strong enough.

* This change adds ComponentSelectionReason#isCompositeBuild() that can

be checked by consumers (e.g. Build Scan plugin) to detect this scenario

Signed-off-by: Rene Groeschke <rene@gradle.com>

  1. … 2 more files in changeset.
Improve assertions in bom support smoke test

  1. … 1 more file in changeset.
Add smoke test for bom support

The test resolves dependencies for a spring boot project by using

the spring boot dependencies BOM. There are three variants of the

test using different mechanisms for BOM support:

- Built-in support from Gradle

- Nebula Recommender Plugin

- Spring Dependency Management Plugin

    • -0
    • +634
    ./ResolveTestFixture.groovy
  1. … 2 more files in changeset.