ResolutionStrategy: Get attributes of variant

Hey,
I try to substitute a dependency with two variants to select the correct one.

How can I get the attributes of the conflicting variants?

The sample Customizing resolution of a dependency directly only hardcodes the attributes, which should match, but I would get the defined attributes from the variants to set attributes based on the available variant attributes.

resolutionStrategy {
  it.disableDependencyVerification()
    it.dependencySubstitution {
      val given = it.module(pomCoordinates)
      val givenAttrs = given.attributes

      it.substitute(it.variant(given) {
        // do something with, but givenAttrs is empty...              
            }
          })
            .using(given)
        }
      }