maybeAddVariant

abstract fun maybeAddVariant(name: String, base: String, action: Action<in VariantMetadata>)(source)

This is the lenient version of addVariant. The only difference is that this will do nothing (instead of throwing an error), if the 'base' variant does not exist for a component. This is particularly useful for rules that are applied to all components.

Since

6.1

Parameters

name

a name for the variant

base

name of the variant (pom or Gradle module metadata) or configuration (ivy.xml metadata) from which the new variant will be initialized

action

the action to populate the variant