Package org.gradle.api.component
Interface AdhocComponentWithVariants
- All Superinterfaces:
Named
,SoftwareComponent
A component which can declare additional variants corresponding to
features. When published to Maven POMs, the dependencies of those variants
are exposed as optional dependencies. When published to Gradle metadata, the
variants are published as is.
- Since:
- 5.3
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
Named.Namer
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addVariantsFromConfiguration
(Configuration outgoingConfiguration, Action<? super ConfigurationVariantDetails> action) Declares an additional variant to publish, corresponding to an additional feature.void
withVariantsFromConfiguration
(Configuration outgoingConfiguration, Action<? super ConfigurationVariantDetails> action) Further configure previously declared variants.
-
Method Details
-
addVariantsFromConfiguration
void addVariantsFromConfiguration(Configuration outgoingConfiguration, Action<? super ConfigurationVariantDetails> action) Declares an additional variant to publish, corresponding to an additional feature.This can be used to determine if the variant should be published or not, and to configure various options specific to the publishing format.
- Parameters:
outgoingConfiguration
- the configuration corresponding to the variant to use as source of dependencies and artifactsaction
- action executed to configure the variant prior to publishing
-
withVariantsFromConfiguration
void withVariantsFromConfiguration(Configuration outgoingConfiguration, Action<? super ConfigurationVariantDetails> action) Further configure previously declared variants.The action can be used to determine if the variant should be published or not, and to configure various options specific to the publishing format. Note that if multiple actions are added, they are executed in the order they were added.
- Parameters:
outgoingConfiguration
- the configuration corresponding to the variant to configure with a given actionaction
- an additional action to be executed to configure the variant prior to publishing- Throws:
InvalidUserDataException
- if the specified variant was not already added to this component
-