For AI agents: the documentation index is at https://docs.gradle.org/llms.txt. Request any page with the header Accept: text/markdown to get Markdown. User manual pages are also available as Markdown by replacing .html with .md in the URL.

withVariant

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

Add a rule for adjusting an existing variant of the component.

Since

4.4

Parameters

name

name of the variant to adjust (e.g. 'compile')

action

the action to modify the variant