Skip to content

Update metro to v0.13.0#49

Open
vRallev wants to merge 1 commit intomainfrom
renovate/metro
Open

Update metro to v0.13.0#49
vRallev wants to merge 1 commit intomainfrom
renovate/metro

Conversation

@vRallev
Copy link
Copy Markdown
Collaborator

@vRallev vRallev commented Apr 5, 2026

This PR contains the following updates:

Package Change Age Confidence
dev.zacsweers.metro 0.12.10.13.0 age confidence
dev.zacsweers.metro:runtime 0.12.10.13.0 age confidence
dev.zacsweers.metro:compiler 0.12.10.13.0 age confidence

Release Notes

ZacSweers/metro (dev.zacsweers.metro)

v0.13.0

Compare Source

2026-04-04

New
Circuit codegen

Metro now includes experimental built-in support for Circuit, a Compose-first architecture for building kotlin apps. See the docs for more details.

In the long term, this will eventually move out to a separate plugin that can gracefully participate with Metro's code gen APIs. This is initially implemented within Metro to ease development.

generateContributionProviders

This release introduces a new generateContributionProviders API (Kotlin 2.3.20+) to optimize behavior with contributed APIs.

Up to now, Metro's aggregation APIs (i.e. @Contributes* binding annotations) have worked similar to Anvil, where the ultimately just generate @Binds declarations as simple shorthands for the consuming graphs. This comes with the caveat that the injected class must be publicly visible if it's used outside of that module.

Now, if you enable the new generateContributionProviders feature, Metro will instead generate top-level @Provides declarations that mirror the injected class's inputs but only return its bound type. This means the annotated class can remain internal, which both helps encapsulation and incremental compilation.

interface Base

@​ContributesBinding(AppScope::class)
@​Inject
internal class Impl : Base

// Works across modules!
@​DependencyGraph(AppScope::class)
interface AppGraph {
  val base: Base
}

The tradeoff is that Impl is no longer available directly on the graph. If you had any explicit code usages of Impl, you would have to remove those too in favor of purely the bound type.

[MEEP-1776] @DefaultBinding

This release introduces a new @DefaultBinding annotation that allows for setting a default binding on supertypes of contributed classes. This is useful for common base classes with generics that would otherwise require repetitive (or error-prone) explicit binding<T>() declarations in subtypes.

@&#8203;DefaultBinding<BaseFactory<*>>
interface BaseFactory<T : BaseFactory<T>>

@&#8203;ContributesIntoSet(AppScope::class) // now implicitly contributed as BaseFactory<*>
@&#8203;Inject
class HomeFactory(...) : BaseFactory<HomeFactory>
Enhancements
  • [IR] Use more unique diagnostic names in IR diagnostics (previously just used METRO_ERROR for a general catch-all in a lot of places).
Fixes
  • [IR] Consider Anvil's rank parameter when processing contributed binding containers.
  • [IR] When reporting qualifier mismatches, if a qualifier is absent on one declaration then the message will now say "absent" rather than the vague "null".
Changes
  • Support Kotlin 2.4.0-Beta1
  • Removed @Assisted.value. See the docs on why in case you missed this! TL;DR, Metro matches by parameter names going forward.
  • Remove deprecated compiler options and Gradle extension properties.
    • chunkFieldInits
    • transformProvidersToPrivate
    • publicProviderSeverity (use publicScopedProviderSeverity)
    • assistedIdentifierSeverity
    • generateThrowsAnnotation
Contributors

Special thanks to the following contributors for contributing to this release!

Consider sponsoring Metro's development

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Renovate Bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants