Skip to content

Update metro to v1.4.0 - #1213

Merged
fobo66 merged 1 commit into
mainfrom
renovate/metro
Jul 31, 2026
Merged

Update metro to v1.4.0#1213
fobo66 merged 1 commit into
mainfrom
renovate/metro

Conversation

@renovate

@renovate renovate Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
dev.zacsweers.metro 1.3.21.4.0 age confidence
dev.zacsweers.metro:metrox-viewmodel-compose 1.3.21.4.0 age confidence
dev.zacsweers.metro:metrox-android 1.3.21.4.0 age confidence

Release Notes

ZacSweers/metro (dev.zacsweers.metro)

v1.4.0

Compare Source

2026-07-30

New
Experimental support for suspend providers

This release introduces experimental support for suspend providers. This is disabled by default and can be enabled by the metro.enableSuspendProviders option. See the coroutines documentation for details.

  • @Provides functions and graph accessors can be suspend. Suspension propagates through dependent bindings. Metro reports a dependency trace when a non-suspend path reaches one.
  • Inject suspend () -> T to defer initialization until invocation, or SuspendLazy<T> to also cache the first successful result. Provider, function providers, Lazy, SuspendProvider, suspend functions, and SuspendLazy can be nested to any depth in a scalar wrapper stack.
    • When the underlying binding suspends, the wrapper closest to it must also support suspension. Maps can defer initialization of individual values with Map<K, suspend () -> V> or Map<K, SuspendProvider<V>>.
    • Wrapper layers and supported map values preserve nullable binding types.
  • Like ordinary scoped bindings, scoped suspend bindings are single-flight and retry after failures or cancellation. They also run on the coroutine context they were called on, so if this is important then you should use an appropriate withContext within your provider body.
  • The Gradle plugin automatically adds the new runtime-coroutines artifact when suspend providers are enabled. If runtime dependencies are managed manually, add it for scoped suspend bindings, suspendLazy, and injection requests containing SuspendLazy at any nesting level.
    • runtime-coroutines uses kotlinx-coroutines on every platform.
  • Note: Switching providers do not yet support suspend providers. You can still enable them, just scoped suspend provider fields will not be sharded into nested switching provider classes yet.
Other new stuff
  • [FIR/IR/Circuit] Support sub-circuits (i.e. the new @SubCircuitInject annotation).
Enhancements
  • Support private @Provides properties on Kotlin 2.4.20-Beta1 and newer.
  • [IR] Improve IC on Kotlin 2.3.20 by backporting compat support for the compiler's new declaration finder APIs.
  • [IR] Avoid generating unused provider fields for included graph accessors that can be read directly.
  • [IR] Avoid linear helper traversal in large switching providers by routing directly to the matching chunk.
  • [runtime] If the input function to provider() is already a Provider instance, return it directly rather than needlessly wrap it.
  • [runtime] Support nullable values in ordinary map multibinding factories, including provider and lazy map value forms.
Fixes
  • [FIR] Report a diagnostic when private @Provides properties are used without compiler support (i.e. pre-2.4.20).
  • [FIR] Report an error when a map key is applied (via type argument) to a binding without a corresponding @IntoMap or @ContributesIntoMap annotation.
  • [IR] Fix stale contribution hints after changing a contribution's scope during incremental compilation. This only affects Kotlin versions prior to 2.3.20.
  • [IR] Fix Kotlin/Native compilation failures when generated hidden classes were missing their Any supertype.
  • [IR] Prevent directly provided maps from satisfying suspend-provider-valued map requests unless the provided map uses that exact value type.
  • [IR] Avoid redundant nested DoubleCheck.lazy() calls when materializing Lazy graph accessors and binding parameters.
  • [IR] Correctly adapt function-provider accessors from included graphs when storing them as Metro Provider fields.
  • [IR] Fix graph implementations incorrectly inheriting the containing class of nested @ContributesTo interfaces with IR class generation.
  • [IR] Don't inline object, enum, or class-literal provider bindings when they're requested through Provider, Lazy, or provider-based multibindings.
  • [gradle] Respect metro.generateClassesInIr Gradle and system property overrides instead of replacing them with the Kotlin-version default.
  • Improve Kotlin 2.4.20-Beta2 support.
Changes
  • Refreshed benchmarks!
    • They now run against latest Metro, Dagger, and KSP versions.
      • Dagger + KSP have improved significantly 🚀.
    • They now also include Koin.
  • Build against Kotlin 2.4.10. Note the runtime artifacts still target Kotlin 2.3.0 and Metro supports a wide range of compiler versions. See the compatibility docs for a full table of compatible versions.
  • Test IntelliJ 2026.2 stable.
  • Test Android Studio Quail 4 canaries.
  • Switch shaded Mordan dependency to just mordant-core.
  • Update shaded Okio dependency to 3.18.1.
  • Update androidx.tracing to 2.0.0-rc01.
Contributors

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


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 was generated by Mend Renovate. View the repository job log.

@fobo66
fobo66 merged commit e69a3a3 into main Jul 31, 2026
3 checks passed
@fobo66
fobo66 deleted the renovate/metro branch July 31, 2026 19:47
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.

1 participant