ArtifactSelectionIntegrationTest.groovy

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Migrate more tests to using the new API

    • -6
    • +8
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 10 more files in changeset.
Migrate more test to using the new API

    • -6
    • +8
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 12 more files in changeset.
Migrate more test to using the new API

    • -6
    • +8
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 12 more files in changeset.
WIP

    • -6
    • +8
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 12 more files in changeset.
Align implementations of artifact identifier display names

DefaultModuleComponentArtifactIdentifier now behaves similar as

ComponentFileArtifactIdentifier (showing the full actual file name).

This means that the artifact name used during reporting now

contains the version at the usual position in the file name.

This way it shows the actual file name for artifacts originating

from pom-only maven repositories (except snapshots, which show the

SNAPSHOT placeholder) and ivy repositories with default pattern.

The motivation for this alignment is to get the same representation for

the same file, independent of whether it was sourced from traditional

or Gradle module metadata.

    • -3
    • +3
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 32 more files in changeset.
Align implementations of artifact identifier display names

DefaultModuleComponentArtifactIdentifier now behaves similar as

ComponentFileArtifactIdentifier (showing the full actual file name).

This means that the artifact name used during reporting now

contains the version at the usual position in the file name.

This way it shows the actual file name for artifacts originating

from pom-only maven repositories (except snapshots, which show the

SNAPSHOT placeholder) and ivy repositories with default pattern.

The motivation for this alignment is to get the same representation for

the same file, independent of whether it was sourced from traditional

or Gradle module metadata.

    • -3
    • +3
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 32 more files in changeset.
Rework configuration / variant exception messages

* For ambiguity issues, other attributes are listed before compatible

attributes.

* For incompatibility issues, incompatible attributes are listed first,

followed by other attributes.

Issue #8747

    • -22
    • +37
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 19 more files in changeset.
Rework configuration / variant exception messages

* For ambiguity issues, other attributes are listed before compatible

attributes.

* For incompatibility issues, incompatible attributes are listed first,

followed by other attributes.

Issue #8747

    • -22
    • +37
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 19 more files in changeset.
Rework configuration / variant exception messages

* For ambiguity issues, other attributes are listed before compatible

attributes.

* For incompatibility issues, incompatible attributes are listed first,

followed by other attributes.

Issue #8747

    • -22
    • +37
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 19 more files in changeset.
Rework configuration / variant exception messages

* For ambiguity issues, other attributes are listed before compatible

attributes.

* For incompatibility issues, incompatible attributes are listed first,

followed by other attributes.

Issue #8747

    • -22
    • +35
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 15 more files in changeset.
Add disambiguation rule to select the closest match

Whenever, after disambiguation of requested and extra attributes,

there are still more than one candidate, we're going to look for

variants which match exactly the requested attributes (independently

of their values).

    • -0
    • +2
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 2 more files in changeset.
Tweak the output produced by `TreeFormatter`.

    • -8
    • +10
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 36 more files in changeset.
Consistently use component level attributes

Component-level attributes were only used if the component metadata was using Gradle

metadata. This was particularly confusing, as it was possible to define a component-

level attribute in a component-metadata rule, but it would be ignored during matching.

It was possible, however, to add attributes on variants of Ivy or Maven metadata,

but then the error messages in case there wasn't any match was even more confusing:

"Because there are no configurations with attributes"

This commit modifies the resolution engine so that it's possible to use component

level attributes independently of whether the underlying component metadata was

constructed from Ivy, Maven or Gradle metadata. It also changes the error messages

to mention either "configuration" or "variant" depending on whether the matching

strategy was using variant-aware dependency management *or* legacy configurations.

It was confusing because we have the `IMPROVED_POM_SUPPORT` flag which activates

variant construction from Maven metadata. This meant that in practice, if the flag

was active, we were using variants, but still the component level attributes were

not taken into account. If the flag wasn't active, then we would fail with the

error above, despite the fact we had rules on "configuration backed variants".

The separation of configuration/variant in error messages makes it easier for

us to understand in which case we are, since this wasn't always obvious. If we

see "variant", then now we know that the selection failed using the variant-aware

matching. If we see "configuration", then we know it's using the legacy mode.

This commit also needed to make the difference between "this component has no

variant" and "this component doesn't provide any mapping to variants", therefore

the introduction of the `Optional` on `getVariantsForTraversal`. This gives us

the opportunity to give the correct error message in case of failure using

the legacy mode.

Last but not least, this introduces a change in the attributes visible on variants

**and** artifacts. Before this commit, dependending on whether metadata was

Gradle metadata, the "status" attribute would be found or not. Now, the component

level attributes are _always_ merged to variant and artifact attributes, which

means that it's consistent independently of the format. This can be a breaking

change, but a low risk one.

    • -1
    • +2
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 39 more files in changeset.
Improved error reporting when unable to select a matching variant during artifact resolution to add some context about which component the problematic variant belongs to.

    • -0
    • +80
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 5 more files in changeset.
Remove `assumeCompatibleWhenMissing` from `CompatibilityRuleChain`

This method was already a no-op. Now is time for removal.

    • -7
    • +3
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 10 more files in changeset.
Treat various kinds of dependency resolution failures in more consistent ways.

- When a non-lenient view is used as a task input, then propagate any failure to select a configuration in the dependency graph during task graph calculation, rather than suppressing these kinds of failures and propagating later when the files happen to be queried. This now happens consistently whether fluid dependencies are used or not. The only difference between these is how much of the graph is traversed at task graph calculation time.

- When a lenient view is used as a task input, suppress configuration selection failures during task graph calculation and instead present them in `ArtifactCollection.failures`. Do this consistently regardless of whether fluid dependencies are used or not. Previously this kind of failure was propagated during task graph calculation for lenient views.

Also changed the error message on resolution failure to include what kind of query was being performed at the time to trigger the failure.

From an implementation point of view, separated the handling of selection failures from the code that produces the legacy resolution result so that this handling can be reused when the legacy result is not required (such as, say, when calculating the task graph).

    • -3
    • +5
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 34 more files in changeset.
Reworked the collection of file dependencies during dependency graph traversal, so that the files from these dependencies are ordered the same way as other kinds of dependencies, rather than always ordering these files at the start of the result.

    • -7
    • +7
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 16 more files in changeset.
Changed variant attribute matching to prefer variants whose value for a particular attribute is the same as the consumer value, over those variants whose value is different to but compatible with the consumer value. That is, added a hard-coded rule to say "prefer the requested value over all others" when disambiguating matches.

    • -1
    • +1
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 6 more files in changeset.
Some improvements to the formatting of 'no matching variant' and 'too many matching variant' error messages.

Also replaced some usages of `Factory<String>` with `Describable` to represent the display name of various child objects of `Configuration`.

    • -6
    • +20
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 37 more files in changeset.
Improved the 'no matching variant' and 'too many matching variant' error messages to use a better description of each of the variants, such as which project/module and configuration the variant belongs to.

Made a bunch of changes to forward the display name of the variant from where the variant originates from through to the variant selection logic so it can construct the error messages, using `Describable` to represent the display name.

    • -6
    • +6
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 34 more files in changeset.
Changed attribute matching so that a missing attribute is always considered compatible.

`CompatibilityRuleChange.assumeCompatibleWhenMissing()` is now a no-op and will be removed shortly.

    • -11
    • +0
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 11 more files in changeset.
Added some constraints on the 'from' and 'to' attributes for a consumer provided variant, to help the user avoid attempting various cases that are not yet really supported.

- The 'to' and 'from' attributes must be not empty. Empty 'from' basically means "I can transform _any_ input" and an empty 'to' basically means "I can produce _any_ output (without knowing what it is)", neither of which make much sense.

- The 'to' attributes must be a subset of the 'from' attributes. Adding attributes to make a more specific variant is not required yet, and will break when switching 'compatible when missing' to default to true. For now, disable this case.

    • -1
    • +4
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 7 more files in changeset.
Don't treat a failure to select a producer variant as a fatal failure, and instead treat it the same way as other artifact resolution failures, by collecting the failure and continuing.

This change means that these failures appear in the result returned by `ArtifactCollection.getFailures()` for a lenient collection.

    • -1
    • +2
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 7 more files in changeset.
Include the component display name in the various error messages when unable to select a variant of the component (such as multiple matches, no matches, etc), to help with diagnostics.

    • -2
    • +2
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 15 more files in changeset.
Fail when no compatible variant can be selected for a component. Continue to ignore components with no compatible variant when using an `ArtifactView` with additional attributes defined, whose implicit contract is to ignore these (this should be an explicit contract).

Made some changes to error messages so that failure to select a variant shows the same useful details as a failure to select a configuration.

    • -20
    • +75
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 24 more files in changeset.
Added more test coverage for variant selection through various APIs.

    • -23
    • +46
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 2 more files in changeset.
Fail dependency resolution when variant selection matches more than one variant and cannot disambiguate between them. Previously, it would select the first match.

    • -39
    • +99
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 3 more files in changeset.
Don't ignore the producer's attributes when selecting a variant.

    • -29
    • +31
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 4 more files in changeset.
Added some initial support to honour the producer's schema when selecting a particular variant of something.

    • -0
    • +146
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 18 more files in changeset.
Review and improve tests that require exact ordering of tasks

    • -3
    • +3
    ./ArtifactSelectionIntegrationTest.groovy
  1. … 23 more files in changeset.