Gradle / subprojects / dependency-management / src / ... / integtests / resolve / attributes
CrossProjectMultipleVariantSelectionIntegrationTest.groovy
6b11be2Add validation step for multiple variant selection
This commit adds a graph validation step, which checks that if multiple variants of a single component are selected, they have compatible attributes. Currently, compatible means _identical_. If we want to improve this further, next steps would be to do this during selection instead of validation, and potentially substitute one selected variant with the other when one is fully compatible with the other (in other words, all its common attributes are compatible with the other variant). This, however, would likely have a performance impact in selection. 69452fdInitial support for optional features
This commit introduces initial support for optional features, by implementing a way for a dependency declaration (currently *only* in the DSL) to request variants of the target component that provide one or more capabilities. Previously to this change, selection was (simplified) done like this: 1. find the target component 2. select the variant of the target component which matches the requested attributes Now, selection introduces another step: 1. find the target component 2. filter variants by eliminating those which do not provide the requested capabilities 3. select the variant in this list which matches the requested attributes Several changes had to be implemented: First, component metadata rules calling `addCapability` will now return a component which capabilities _include_ the default capability. Second, attribute filtering is done in a secondary step, which means that if there are no variant matching the requested capabilities, we will immediately fail. |
![]() |