Skip to content

Conversation

playground-manager[bot]
Copy link
Contributor

@playground-manager playground-manager bot commented Oct 8, 2025

This PR contains the following updates:

Package Type Update Change
dev.zacsweers.metro plugin minor 0.6.8 -> 0.7.0

Release Notes

ZacSweers/metro (dev.zacsweers.metro)

v0.7.0

Compare Source

2025-10-17

Dynamic Graphs

Dynamic graphs are a powerful new feature of the Metro compiler that allows for dynamically replacing bindings in a given graph. To use them, you can pass in a vararg set of binding containers to the createDynamicGraph() and createDynamicGraphFactory() intrinsics.

@​DependencyGraph
interface AppGraph {
  val message: String

  @​Provides fun provideMessage(): String = "real"
}

class AppTest {
  val testGraph = createDynamicGraph<AppGraph>(FakeBindings)

  @&#8203;Test
  fun test() {
    assertEquals("fake", testGraph.message)
  }

  @&#8203;BindingContainer
  object FakeBindings {
    @&#8203;Provides fun provideMessage(): String = "fake"
  }
}

This is particularly useful for tests. See their docs for more information: Dynamic Graphs.

This API is experimental and may change in the future, please report any issues you encounter!

Implicit @Inject behavior on (most) @Contributes*-annotated types

Up to this point, Metro has always required you to use @Inject on most @Contributes* annotated types. However, this can feel a bit repetitive and tedious. In this release, there is a new contributesAsInject option that can be enabled that will treat all @Contributes* annotated types as @Inject by default. You can still use @Inject on classes to be explicit, and if you have multiple constructors you must still use @Inject on the constructor you want to be used.

The only exception to this is @ContributesTo, which isn't applicable to injected types.

This is disabled by default to start but will likely become the default in a future release.

@&#8203;ContributesBinding(AppScope::class)
// @&#8203;Inject // <-- now implicit!
class TacoImpl(...) : Taco
Other Changes
  • Behavior change: Remove assistedInjectMigrationSeverity DSL. You must now move fully to using @AssistedInject annotations for assisted types.
  • New: Allow exposing assisted-injected classes on a graph with qualifier annotations via @Provides declarations. This means you could, for example, write a provider like so:
    @&#8203;Provides @&#8203;Named("qualified")
    fun provideTaco(factory: Taco.Factory): Taco = factory.create("spicy")
  • New: Add diagnostic disallowing qualifier annotations directly on @AssistedInject-annotated classes.
  • New: Add wasmWasi targets to Metro's runtime.
  • New: Add diagnostic to report positional arguments use in custom interop annotations. See the interop docs for more information. This is disabled by default but can be configured via the interopAnnotationsNamedArgSeverity option.
  • New: Support context parameters on top-level injected functions. See the docs for more information.
  • New: Improve diagnostic checks around binding container arguments to annotations and graph creators.
  • New: Add a diagnostic to warn on suspicious injection of unqualified object classes.
  • Enhancement: Add diagnostic for providing a constructor-injected class with a different scope than the class (if the class has a scope).
  • Enhancement: Allow replacing/excluding binding containers by @Origin annotations.
  • Fix: Don't use interoped annotation arguments at matching indices if their name does not match the requested name.
  • Fix: Trace all member injection dependencies from supertypes in graph reachability computation.
  • Fix: Use compat getContainingClassSymbol() (fixes Kotlin 2.3.0-x compatibility).
  • Fix: Better escape field names to be valid in JVM.
  • Fix: Don't double-invoke Optional binding fields.
  • Fix: Don't report duplicate bindings if injectors for both a parent and child class are present on a graph.
  • Fix: Look up correct target class ID for computed member injectors in BindingLookup.
  • Fix: Don't allow binding containers to be inner classes.
  • Fix: Don't allow binding containers to be local classes.
  • Fix: Don't allow binding containers to be anonymous objects.
  • Fix: Fix wrong parent graph name in IncompatiblyScopedBindings hint.
  • Fix: Fix replacements for regular contributed types not getting processed in graph extensions.
  • Fix: Don't re-process contribution merging for generated graph extension impls during graph node creation.
  • Fix: Don't reserve provider fields for custom wrapper types like interoped Optional types, avoiding accidental eager initialization in cycles.
  • Change the warning key for redundant provides to more specific REDUNDANT_PROVIDES.

Special thanks to @​erawhctim and @​CharlieTap for contributing to this release!

v0.6.10

Compare Source

2025-10-11

Optional Dependency Behaviors

Graph accessors can now expose optional dependencies, just use @OptionalDependency on the accessor. Note that the accessor must declare a default body that Metro will use if the dependency is absent.

@&#8203;DependencyGraph
interface AppGraph {
  @&#8203;OptionalDependency
  val message: String
    get() = "Absent!"
}

There are a couple of optional configuration for Metro's optional dependency support that can be configured via the optionalDependencyBehavior Gradle DSL:

  • DISABLED - Disallows optional dependencies entirely.
  • REQUIRE_OPTIONAL_DEPENDENCY - Requires optional dependency parameters to also be annotated with @OptionalDependency. This may be preferable for consistency with accessors and/or explicitness.
  • DEFAULT - The default behavior as described above — accessors must be annotated with @OptionalDependency with default bodies and parameters just use default value expressions.
Other changes
  • New: Add interop for Dagger @BindsOptionalOf. Note this is currently only limited to java.util.Optional.
  • Enhancement: Improve error messages for unexpected IrErrorType encounters.
  • Enhancement: Add configurable statementsPerInitFun to option to control the number of statements per init function. Only for advanced/debugging use.
  • Fix: Allow @Includes types themselves (i.e., not their accessors) to be dependencies in generated graphs.
  • Fix: Allow multiple graph extension factory accessors of the same factory type on parent graphs.
  • Fix: Report all missing @Provides body diagnostics rather than returning early.
  • Fix: Allow open members from abstract graph class superclasses to be accessors.
  • Fix: When detecting default function/property getter bodies in graph accessors, check for open modality as well.
  • Fix: Don't duplicate includes accessor keys across multiple parent context levels.
  • Fix: Fix not respecting ref counting when allocating provider fields for constructor-injected class providers. This should reduce generated graph code size quite a bit.

Special thanks to @​ChristianKatzmann for contributing to this release!

v0.6.9

Compare Source

2025-10-07

This release introduces new experimental support for multiple compiler and IDE versions. The primary goal of this is to better support running Metro's FIR extensions across different IntelliJ Kotlin Plugin versions and make IDE support more robust, and general compiler compatibility falls out of that more or less for free. This is experimental and only going to target forward compatibility.

  • New: Report more IR errors up to a maximum. The default is 20, but is configurable via the maxIrErrors Gradle DSL option. If you want to restore the previous "fail-fast" behavior, you can set this value to 1.
  • New: Generate specific containing names in Kotlin 2.3.0+ when generating top-level functions for hint gen.
  • Behavior change: Assisted-inject types can only be directly exposed on a graph if qualified.
  • Behavior change: Update the Gradle plugin to target Kotlin 2.0, which requires Gradle 8.11 or later.
  • Enhancement: Improve compatibility across 2.2.20 and 2.3.0+ releases. This release should be compatible with both!
  • Enhancement: Add diagnostic for directly injecting unqualified assisted-injected classes rather than using their factories.
  • Enhancement: Add diagnostic mixing Provider and Lazy types for Provider<Lazy<T>> injections.
  • Enhancement: Add diagnostics for custom map keys.
  • Enhancement: Fully allow exposing Provider<Lazy<T>> accessor types.
  • Enhancement: Significantly improve duplicate binding error message rendering.
  • Enhancement: Inline internal trace functions to reduce overhead.
  • Enhancement: Don't always generate fields for MembersInjector bindings.
  • Enhancement: Improve formatting of long cycles in DependencyCycle error messages.
  • Enhancement: Improve formatting of aliases in DependencyCycle error messages. Aliases are now indicated with ~~> arrows instead of -->.
  • Enhancement: Improve formatting of member declarations in error messages for better IDE linking (if in the IDE terminal/console output) by using . separators instead of #.
  • Fix: Avoid obscure UnsupportedOperationException failures when reporting missing bindings.
  • Fix: Only generate assisted factories if @AssistedInject annotations are used on the target class.
  • Fix: Remove PsiElement shading workaround when reporting diagnostics.
  • Fix: Treat MembersInjector types as implicitly deferrable in binding graph validation.
  • Fix: Report cycles in form of binding --> dependency rather than the reverse for better readability.

Special thanks to @​kevinguitar, @​hossain-khan, and @​vRallev for contributing to this release!


Configuration

📅 Schedule: 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 is behind base branch, or you tick the rebase/retry checkbox.

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


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

This PR has been generated by Renovate Bot.

@playground-manager playground-manager bot force-pushed the renovate/dev.zacsweers.metro-0.x branch 8 times, most recently from dc5b83c to f87a137 Compare October 12, 2025 12:07
@playground-manager playground-manager bot changed the title chore(deps): update plugin zac-metro to v0.6.9 chore(deps): update plugin zac-metro to v0.6.10 Oct 12, 2025
@playground-manager playground-manager bot force-pushed the renovate/dev.zacsweers.metro-0.x branch 8 times, most recently from 6c543cf to 67f0ffe Compare October 17, 2025 00:20
Copy link
Contributor

Build scan published to https://gradle.com/s/q4nuvzejhz46s

@playground-manager playground-manager bot force-pushed the renovate/dev.zacsweers.metro-0.x branch from 67f0ffe to d99c32f Compare October 17, 2025 12:08
@playground-manager playground-manager bot changed the title chore(deps): update plugin zac-metro to v0.6.10 chore(deps): update plugin zac-metro to v0.7.0 Oct 17, 2025
@playground-manager playground-manager bot force-pushed the renovate/dev.zacsweers.metro-0.x branch 2 times, most recently from d97191a to 3a2dbb3 Compare October 19, 2025 00:22
Copy link
Contributor

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.

@playground-manager playground-manager bot force-pushed the renovate/dev.zacsweers.metro-0.x branch from 3a2dbb3 to 49636fc Compare October 19, 2025 12:08
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.

0 participants