MetroPluginExtension
Constructors
Properties
Automatically adds Metro runtime artifact dependencies.
Override the Kotlin compiler version Metro operates with.
Compiler version aliases mapping fake IDE versions to their real compiler versions.
Treats @Contributes* annotations, except @ContributesTo, as implicit @Inject annotations.
Severity for desugared Provider<T> function types. Prefer () -> T.
Build-output rendering mode for diagnostics. See the docs on DiagnosticsRenderMode for details.
Generates Metro-native Circuit bindings for @CircuitInject classes and functions. Metro will generate Ui.Factory and Presenter.Factory implementations for @CircuitInject-annotated classes and functions.
Treats () -> T as a provider type.
Shards generated binding graphs. Enabled by default.
Treats java.lang.Class and kotlin.reflect.KClass as interchangeable in multibinding map key types, matching Kotlin's own annotation compilation behavior. This only applies to map keys because these are the only scenario where annotation arguments are materialized into non-annotation code (i.e. @ClassKey(Foo::class) -> Map<Class<*>, V>).
Checks klib parameter qualifiers.
Enables Kotlin version compatibility checks. Defaults to true or the value of the metro.version.check Gradle property.
Enables bytecode/IR tracing for binding injections using androidx.tracing.
Uses SwitchingProviders for deferred class loading. This reduces graph initialization time by deferring bindings' class init until the binding is requested.
Enables injection for top-level functions. See the kdoc on Inject for more details.
Enables Metro FIR extensions in the IDE even when the compat layer cannot be determined.
Generates assisted factories automatically for injected constructors with assisted parameters. See the kdoc on AssistedFactory for more details.
Generates metadata-visible hidden classes in IR instead of FIR when supported by the Kotlin compiler.
Generates contribution hints in IR.
Generates contribution hints in FIR. Requires generateContributionHints to be true.
Generates top-level contribution provider classes with @Provides functions instead of nested binding containers with @Binds callables for @ContributesBinding, @ContributesIntoSet, and @ContributesIntoMap.
Severity for interop annotations that use positional arguments instead of named arguments.
Maximum binding keys per graph shard when sharding is enabled. Default is 2000. Must be > 0.
Maximum errors to report before exiting IR processing. Default is 20. Must be > 0.
Severity for non-public @Contributes* declaration diagnostics. This includes declarations that are internal, private, protected, nested in non-public classes, etc.
Optional binding behavior. Default is OptionalBindingBehavior.DEFAULT.
Patches klib parameter qualifiers to work around a kotlinc bug. Only applies when enableKlibParamsCheck is also enabled.
Severity for public scoped-provider diagnostics. See the kdoc on Provides for more details.
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/...).
Maximum statements per init method when chunking field initializers. Default is 25. Must be > 0.
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.
If set, the Metro compiler will dump compiler trace information to the given destination. Outputs are per-compilation granularity (i.e. build/metro-traces/main/...).
Severity for unused graph inputs, such as factory parameters and directly included binding containers that are not used by the graph.
Suggests moving @Inject/@AssistedInject to the class when it has only one constructor. Enabled by default.