MetroPluginExtension

abstract class MetroPluginExtension @Inject constructor(baseKotlinVersion: KotlinToolingVersion, layout: ProjectLayout, objects: ObjectFactory, providers: ProviderFactory)(source)

Constructors

Link copied to clipboard
@Inject
constructor(baseKotlinVersion: KotlinToolingVersion, layout: ProjectLayout, objects: ObjectFactory, providers: ProviderFactory)

Types

Link copied to clipboard
abstract class InteropHandler @Inject constructor(objects: ObjectFactory)

Properties

Link copied to clipboard
val chunkFieldInits: Property<Boolean>

Enable/disable chunking of field initializers. Enabled by default.

Link copied to clipboard

If enabled, treats @Contributes* annotations (except ContributesTo) as implicit @Inject annotations.

Link copied to clipboard
val debug: Property<Boolean>

If enabled, the Metro compiler plugin will emit extremely noisy debug logging.

Link copied to clipboard
val enabled: Property<Boolean>

Controls whether Metro's compiler plugin will be enabled on this project.

Link copied to clipboard

Enable/disable full validation of bindings. If enabled, all declared @Provides and @Binds bindings will be validated even if they are not used by the graph. Disabled by default.

Link copied to clipboard

If true changes the return type of generated Graph Factories from the declared interface type to the generated Metro graph type. This is helpful for Dagger/Anvil interop.

Link copied to clipboard

Enable/disable Kotlin version compatibility checks. Defaults to true or the value of the metro.version.check gradle property.

Link copied to clipboard
@DelicateMetroGradleApi(message = "Top-level function injection is experimental and does not work yet in all cases. See the kdoc.")
val enableTopLevelFunctionInjection: Property<Boolean>

Enables whether the Metro compiler plugin can inject top-level functions. See the kdoc on Inject for more details.

Link copied to clipboard

Enables whether the Metro compiler plugin will automatically generate assisted factories for injected constructors with assisted parameters. See the kdoc on AssistedFactory for more details.

Link copied to clipboard

Enable/disable contribution hint generation in IR for contributed types. Enabled by default.

Link copied to clipboard
@DelicateMetroGradleApi(message = "FIR contribution hint gen is experimental and does not work yet in all cases. See the kdoc.")
val generateContributionHintsInFir: Property<Boolean>

Enable/disable contribution hint generation in FIR. Disabled by default as this is still experimental. Requires generateContributionHints to be true.

Link copied to clipboard
Link copied to clipboard

Configures the Metro compiler plugin to warn, error, or do nothing when it encounters interop annotations using positional arguments instead of named arguments.

Link copied to clipboard
val maxIrErrors: Property<Int>

Maximum number of IR errors to report before exiting IR processing. Default is 20, must be > 0.

Link copied to clipboard

Controls the behavior of optional dependencies on a per-compilation basis. Default is OptionalBindingBehavior.DEFAULT mode.

Link copied to clipboard

Configures the Metro compiler plugin to warn, error, or do nothing when it encounters public provider callables. See the kdoc on Provides for more details.

Link copied to clipboard
@DelicateMetroGradleApi(message = "This should only be used for debugging purposes and is not intended to be always enabled.")
val reportsDestination: DirectoryProperty

If set, the Metro compiler will dump verbose report diagnostics about resolved dependency graphs to the given destination. Outputs are per-compilation granularity (i.e. build/metro/main/...).

Link copied to clipboard

Enable/disable shrinking of unused bindings. Enabled by default.

Link copied to clipboard
val statementsPerInitFun: Property<Int>

Maximum number of statements per init function when chunking field initializers. Default is 25, must be > 0.

Link copied to clipboard
@DelicateMetroGradleApi(message = "Contribution hint gen does not work yet in all platforms on all Kotlin versions. See the kdoc.")
val supportedHintContributionPlatforms: SetProperty<KotlinPlatformType>

Sets the platforms for which contribution hints will be generated. If not set, defaults are computed per-platform and per Kotlin version based on known compatible combinations.

Link copied to clipboard

Enable/disable automatic transformation of providers to be private. Enabled by default.

Link copied to clipboard

Enable/disable suggestion to lift @Inject to class when there is only one constructor. Enabled by default.

Functions

Link copied to clipboard

Configures interop to support in generated code, usually from another DI framework.