Update dependency dev.zacsweers.metro to v0.6.0 #178
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.5.5
->0.6.0
Release Notes
ZacSweers/metro (dev.zacsweers.metro)
v0.6.0
Compare Source
2025-08-15
Graph extensions are no longer detached.
TL;DR: Metro graph extensions are now wired similar to Dagger subcomponents and use a new
@GraphExtension
annotation.@Extends
andisExtendable
are now deleted,@ContributesGraphExtension
andenableScopedInjectClassHints()
are deprecated.Up to this point, Metro's graph extensions have been detached. This meant that extensions could simply depend on a parent graph via
@Extends
and parent graphs had to mark themselves as extendable viaisExtendable = true
. This approach mirrored kotlin-inject's approach and was convenient in its flexibility. However, it's proven too problematic in practice for a few reasons:isExtendable = true
.@Provides
bindings in it or containers, even if they do not use them.enableScopedInjectClassHints()
) to ensure they are also held at the appropriate scope.Metro could optimize the
@ContributesGraphExtension
cases where Metro's compiler has a view of the entire graph chain, but that would frankly leave Metro with a lot of edge cases to deal with and users with needing to know about two different ways to extend graphs. We opted against that, and instead are now going to process graph extensions in a similar way to Dagger's subcomponents.This will allow Metro to
@GraphExtension
@GraphExtension
is a new annotation to denote a graph that is an extension. This is analogous to Dagger's@Subcomponent
and dagger interop treats it as such.To connect an extension to a parent graph, you can do one of multiple ways:
@ContributesTo
.Migration
The following APIs have been removed or deprecated:
@Extends
. Migrate to@GraphExtension
, remove this parameter, and expose the factory in the parent graph API as documented above.isExtendable
is removed from@DependencyGraph
and@ContributesGraphExtension
.@ContributesGraphExtension
is now deprecated and treated like@GraphExtension
.@ContributesGraphExtension.Factory
is deprecated with error severity and requires migration to the new@ContributesTo
pattern.enableScopedInjectClassHints()
is now deprecated and does nothing. It will be removed in the future.To create graph extensions, you now must do so via a parent graph (using one of the above connecting mechanisms).
Other changes
custom-graph
compiler option tocustom-dependency-graph
.custom-dependency-graph-factory
compiler option tocustom-dependency-graph-factory
.MetroPluginExtension.graph
gradle extension property toMetroPluginExtension.dependencyGraph
.MetroPluginExtension.graphFactory
gradle extension property toMetroPluginExtension.dependencyGraphFactory
.@Provides
and@Binds
bindings are now only validated if they are used by the owning graph. Previously, they were always validated.enableStrictValidation()
option.chunkFieldInits()
is now enabled by default.reportsDestination
, Metro will generate files with a list of all the keys in that cycle.dagger.Lazy
types by allowingProvider
subtypes to be wrapped too.rank
interop on Anvil annotations in contributed graph extensions.ignoreQualifier
interop on Anvil annotations in contributed graph extensions.rank
replacements in FIR.@Binds
contributions unless it's an@IntoMap
binding.MapProviderFactory.builder().build()
for Dagger interop onMap<Key, Provider<Value>>
types as there is noMapProviderFactory.empty()
.@ContributesGraphExtension
to have aggregation scopes during graph generation.@Multibinds
declarations to extensions.2.2.10
.Special thanks to @hossain-khan, @Egorand, @kevinguitar, @jonapoul, and @martinbonnin 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 becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.