Releases: ZacSweers/metro
0.3.3
- Enhancement: Don't unnecessarily wrap
Provider
graph accessors. - Enhancement: Allow multiple contributed graphs to the same parent graph.
- Fix: Don't unnecessarily recompute bindings for roots when populating graphs.
- Fix: Better handle generic assisted factory interfaces.
- Fix: Use fully qualified names when generating hint files to avoid collisions.
- Fix: Support provides functions with capitalized names.
- Fix: Prohibit consuming
Provider<Lazy<...>>
graph accessors. - [internal] Migrate to new IR
parameters
/arguments
/typeArguments
compiler APIs.
Special thanks to @gabrielittner for contributing to this release!
What's Changed
- Update dependency tornado to v6.5 by @renovate in #441
- Update plugin poko to v0.18.7 by @renovate in #442
- Migrate to new parameters API by @ZacSweers in #443
- Don't unnecessarily recompute bindings for roots when populating graphs by @ZacSweers in #445
- Migrate cycle tests to box + IR dump tests by @ZacSweers in #446
- Update dependency androidx.compose.material:material-navigation to v1.8.2 by @renovate in #449
- Update dependency androidx.fragment:fragment-ktx to v1.8.7 by @renovate in #450
- Update dependency androidx.lint:lint-gradle to v1.0.0-alpha05 by @renovate in #451
- Update dependency click to v8.2.1 - autoclosed by @renovate in #452
- Update compose.jb to v1.8.1 by @renovate in #448
- Extract IrGraphGenerator by @ZacSweers in #453
- Refactor out BindingGraphGenerator by @ZacSweers in #454
- Clean up parameters in ProvidesTransformer by @ZacSweers in #455
- Update dependency tornado to v6.5.1 by @renovate in #458
- Update dependency gradle to v8.14.1 by @renovate in #457
- Fix generic AssistedFactory with ViewBinding by @gabrielittner in #462
- Fix capitalized providers by @ZacSweers in #465
- Ensure unique hint files in IR gen by @ZacSweers in #466
- Add more IC tests + placeholder by @ZacSweers in #471
- Optimize graph accessors by @ZacSweers in #473
- Disambiguate nested contributed graph classes by @ZacSweers in #474
Full Changelog: 0.3.2...0.3.3
0.3.2
- Enhancement: Optimize supertype lookups in IR.
- Fix: Fix generic members inherited from generic supertypes of contributed graphs.
- Fix: Fix
@ContributedGraphExtension
that extends the same interface as the parent causes a duplicate binding error. - Fix: Fix contributed binding replacements not being respected in contributed graphs.
- Fix: Fix contributed providers not being visible to N+2+ descendant graphs.
- Fix: Collect bindings from member injectors as well as exposed accessors when determining scoped provider fields.
- Fix: Fix a few
-Xverify-ir
and-Xverify-ir-visibility
issues + run all tests with these enabled now.
Special thanks to @bnorm, @gabrielittner, @kevinguitar, and @JoelWilcox for contributing to this release!
What's Changed
- Use compiler's addFakeOverrides by @kevinguitar in #354
- Update plugin mavenPublish to v0.32.0 by @renovate in #437
- Fix contributed binding replacements not being respected in contributed graphs by @JoelWilcox in #438
- Fix ContributedGraphExtension that extends same interface as parent causes duplicate binding error by @gabrielittner in #417
- Fix contributed providers not being visible to N+2+ descendant graphs by @ZacSweers in #439
- Fix missing binding collection from member injectors by @ZacSweers in #440
- Enable IR verification in :compiler tests by @ZacSweers in #436
- Add KSP to compiler test framework by @bnorm in #418
Full Changelog: 0.3.1...0.3.2
0.3.1
- Enhancement: Rewrite graph resolution using topological sorting to vastly improve performance and simplify generation.
- Enhancement: Return early once an externally-compiled dependency graph is found.
- Enhancement: Simplify multibinding contributor handling in graph resolution by generating synthetic qualifiers for each of them. This allows them to participate in standard graph resolution.
- Enhancement: When there are multiple empty
@Multibinds
errors, report them all at once. - Enhancement: Avoid unnecessary
StringBuilder
allocations. - Fix: Don't transform
@Provides
function's to be private if its visibility is already explicitly defined. - Fix: Fix a comparator infinite loop vector.
- Fix: Fix
@ElementsIntoSet
multibinding contributions triggering a dependency cycle in some situations. - Fix: Fix assertion error for generated multibinding name hint when using both @Multibinds and @ElementsIntoSet for the same multibinding.
- Fix: Fix contributed graph extensions not inheriting empty declared multibindings.
- Fix: Ensure we report the
@Multibinds
declaration location in errors if one is available. - Fix: Dedupe overrides by all parameters not just value parameters.
- Fix: Dedupe overrides by signature rather than name when generating contributed graphs.
- Fix: Fix accidentally adding contributed graphs as child elements of parent graphs twice.
- Fix: Fix not deep copying
extensionReceiverParameter
when implementing fake overrides in contributed graphs. - Fix: Report fully qualified qualifier renderings in diagnostics.
- Fix: Don't generate provider fields for multibinding elements unnecessarily.
- When debug logging + reports dir is enabled, output a
logTrace.txt
to the reports dir for tracing data. - Update to Kotlin
2.1.21
.
Special thanks to @asapha, @gabrielittner, @jzbrooks, and @JoelWilcox for contributing to this release!
What's Changed
- Update dependency dev.zacsweers.kctfork:ksp to v0.7.1 by @renovate in #397
- Update ktor monorepo to v3.1.3 by @renovate in #395
- Don't transform provides status if visibility is explicitly defined by @ZacSweers in #398
- Update plugin buildConfig to v5.6.5 by @renovate in #400
- Fix comparator infitine loop vector by @ZacSweers in #402
- Update compose.jb to v1.8.0 by @renovate in #401
- Update agp to v8.10.0 by @renovate in #405
- Update dependency com.google.googlejavaformat:google-java-format to v1.27.0 by @renovate in #406
- Fix @ElementsIntoSet multibinding contributions triggering a dependency cycle in some situations by @JoelWilcox in #408
- Add more timing logging by @ZacSweers in #404
- Update dependency androidx.compose.material:material-navigation to v1.8.1 by @renovate in #412
- Update dependency androidx.navigation:navigation-compose to v2.9.0 by @renovate in #411
- Update dependency androidx.lifecycle:lifecycle-runtime-compose to v2.9.0 - autoclosed by @renovate in #409
- Update dependency androidx.lifecycle:lifecycle-viewmodel-ktx to v2.9.0 by @renovate in #410
- Revert "Update agp to v8.10.0" by @ZacSweers in #413
- Fix a couple multibinding errors by @JoelWilcox in #419
- Update dependency click to v8.2.0 by @renovate in #421
- Update dependency mkdocs-material to v9.6.13 by @renovate in #420
- Update kotlinInject.anvil to v0.1.5 by @renovate in #416
- Binding graph v3: tarjan's algorithm + topological sorting by @ZacSweers in #423
- Add a failing test for SingleIn when combining Provider and multibindings by @asapha in #403
- Avoid unnecessary StringBuilder allocations by @jzbrooks in #422
- Tweak binding rendering by @ZacSweers in #425
- Update dependency mkdocs-material to v9.6.14 by @renovate in #428
- Update kotlin monorepo to v2.1.21 by @renovate in #427
- Update circuit to v0.28.0 by @renovate in #426
- Several small ContributesGraphExtension fixes! by @asapha in #399
- Improve sorting determinism by @ZacSweers in #433
- Update dependency com.google.devtools.ksp to v2.1.21-2.0.1 by @renovate in #434
- Add more tests for implicit return types by @ZacSweers in #435
New Contributors
Full Changelog: 0.3.0...0.3.1
0.3.0
- New: Add support for
@ContributesGraphExtension
! See the docs for more info. - New: Add a
asContribution()
compiler intrinsic to upcast graphs to expected contribution types. For example:val contributedInterface = appGraph.asContribution<ContributedInterface>()
. This is validated at compile-time. - New: Automatically transform
@Provides
functions to beprivate
. This is enabled by defaults and supersedes thepublicProviderSeverity
when enabled, and can be disabled via the Gradle extension ortransform-providers-to-private
compiler option. Note that properties and providers with any annotations withKClass
arguments are not supported yet pending upstream kotlinc changes. - Enhancement: Rewrite the internal
BindingGraph
implementation to be more performant, accurate, and testable. - Enhancement: Add diagnostic to check that graph factories don't provide their target graphs as parameters.
- Enhancement: Add diagnostic to check that a primary scope is defined if any additionalScopes are also defined on a graph annotation.
- Enhancement: Add diagnostic to validate that contributed types do not have narrower visibility that aggregating graphs. i.e. detect if you accidentally try to contribute an
internal
type to apublic
graph. - Enhancement: Optimize supertype lookups when building binding classes by avoiding previously visited classes.
- Enhancement: Don't generate hints for contributed types with non-public API visibility.
- Enhancement: When reporting duplicate binding errors where one of the bindings is contributed, report the contributing class in the error message.
- Enhancement: When reporting scope incompatibility, check any extended parents match the scope and suggest a workaround in the error diagnostic.
- Enhancement: Allow AssistedFactory methods to be protected.
- Fix: Fix incremental compilation when a parent graph or supertype modifies/removes a provider.
- Fix: Fix rank processing error when the outranked binding is contributed using Metro's ContributesBinding annotation.
- Fix: Fix
@Provides
graph parameters not getting passed on to extended child graphs. - Fix: Fix qualifiers on bindings not getting seen by extended child graphs.
- Fix: Fix qualifiers getting ignored on accessors from
@Includes
dependencies. - Fix: Fix transitive scoped dependencies not always getting initialized first in graph provider fields.
- Fix: Fix injected
lateinit var
properties being treated as if they have default values. - Fix: Alias bindings not always having their backing type visited during graph validation.
- Fix: Fix race condition in generating parent graphs first even if child graph is encountered first in processing.
- Fix: Fallback
AssistedInjectChecker
error report to the declaration source. - Fix: Fix missing parent supertype bindings in graph extensions.
- Change:
InstanceFactory
is no longer a value class. This wasn't going to offer much value in practice. - Change: Change debug reports dir to be per-compilation rather than per-platform.
Special thanks to @gabrielittner, @kevinguitar, @JoelWilcox, and @japplin for contributing to this release!
What's Changed
- Fix rank processing error when the outranked binding is contributed using Metro's ContributesBinding annotation by @JoelWilcox in #343
- Update dependency androidx.compose.material:material-navigation to v1.8.0 by @renovate in #345
- Implement ContributesGraphExtension by @ZacSweers in #340
- Clean up asName() usages by @ZacSweers in #346
- Add a few new diagnostics by @ZacSweers in #347
- Enable gradle lint checks by @ZacSweers in #348
- Flatten project structure by @ZacSweers in #349
- Set up IC tests by @ZacSweers in #332
- Update dependency com.autonomousapps:gradle-testkit-support to v0.18 by @renovate in #352
- Update junit5 monorepo to v5.12.2 by @renovate in #353
- Failing test for extending a generic interface in ContributesGraphExtension.Factory by @kevinguitar in #351
- Update plugin testkit to v0.13 by @renovate in #357
- Update dependency gradle to v8.14 by @renovate in #356
- Update plugin com.gradle.develocity to v4.0.1 by @renovate in #358
- Change reports dir to be per-compilation by @ZacSweers in #360
- Update plugin buildConfig to v5.6.3 by @renovate in #362
- Update kotlinInject to v0.8.0 by @renovate in #367
- Update dependency pymdown-extensions to v10.15 by @renovate in #366
- Don't suggest moving @Inject to class for annotations that don't have CLASS target by @kevinguitar in #371
- Update plugin buildConfig to v5.6.4 by @renovate in #369
- Fix @ContributesGraphExtension missing binding receiver info for contributed bindings by @JoelWilcox in #373
- Update plugin shadow to v9.0.0-beta13 by @renovate in #370
- Update dependency termcolor to v3.1.0 by @renovate in #374
- Update dependency com.google.devtools.ksp to v2.1.20-2.0.1 by @renovate in #376
- Fix error reporting for missing return type in AssistedFactory by @kevinguitar in #378
- Rework BindingGraph by @ZacSweers in #368
- Enable extensions test in CyclesTest by @ZacSweers in #380
- Fix missing parent supertype bindings by @ZacSweers in #381
- Ensure parent graphs are generated before extensions by @ZacSweers in #382
- Check parent scopes for mismatched scope errors by @ZacSweers in #383
- Transform provider functions to be private by default by @ZacSweers in #384
- Fallback AssistedInjectChecker error report to the declaration source by @kevinguitar in #385
- ignore additional non-abstract methods in AssistedFactory by @gabrielittner in #386
- Don't check visibility before modifying it by @ZacSweers in #390
- allow AssistedFactory methods to be protected by @gabrielittner in #387
- Propagate typeresolver when resolving annotations in supertype gen by @ZacSweers in #391
- StatusTransformer improvements by @ZacSweers in #392
New Contributors
- @gabrielittner made their first contribution in #386
Full Changelog: 0.2.0...0.3.0
0.2.0
- New: Nullable bindings are now allowed! See the nullability docs for more info.
- Enhancement: Add diagnostics for multibindings with star projections.
- Enhancement: Add diagnostic for map multibindings with nullable keys.
- Fix: Ensure assisted factories' target bindings' parameters are processed in MetroGraph creation. Previously, these weren't processed and could result in scoped bindings not being cached.
- Fix: Fix duplicate field accessors generated for graph supertypes.
- Add compose navigation sample.
Special thanks to @bnorm and @yschimke for contributing to this release!
0.1.3
- Change: Multibindings may not be empty by default. To allow an empty multibinding,
@Multibinds(allowEmpty = true)
must be explicitly declared now. - New: Write graph metadata to reports (if enabled).
- New: Support configuring debug and reports globally via
metro.debug
andmetro.reportsDestination
Gradle properties (respectively). - Enhancement: Change how aggregation hints are generated to improve incremental compilation. Externally contributed hints are now looked up lazily per-scope instead of all at once.
- Enhancement: Optimize empty map multibindings to reuse a singleton instance.
- Enhancement: Report error diagnostic if Dagger's
@Reusable
is used on a provider or injected class. - Enhancement: Tweak diagnostic error strings for members so that IDE terminals auto-link them better. i.e., instead of printing
example.AppGraph.provideString
, Metro will printexample.AppGraph#provideString
instead. - Enhancement: Support repeatable @ContributesBinding annotations with different scopes.
- Fix: Fix incremental compilation when
@Includes
-annotated graph parameters change accessor signatures. - Fix: Don't allow graph extensions to use the same scope as any extended ancestor graphs.
- Fix: Don't allow multiple ancestor graphs of graph extensions to use the same scope.
- Fix: Handle scenarios where the compose-compiler plugin runs before Metro's when generating wrapper classes for top-level
@Composable
functions. - Fix: Fix an edge case in graph extensions where child graphs would miss a provided scoped binding in a parent graph that was also exposed as an accessor.
- Fix: Fix Dagger interop issue when calling Javax/Jakarta/Dagger providers from Metro factories.
- Fix: Fix Dagger interop issue when calling
dagger.Lazy
from Metro factories. - Fix: Preserve the original
Provider
orLazy
type used in injected types when generating factory creators. - Temporarily disable hint generation in WASM targets to avoid file count mismatches until KT-75865.
- Add an Android sample: https://github.com/ZacSweers/metro/tree/main/samples/android-app
- Add a multiplatform Circuit sample: https://github.com/ZacSweers/metro/tree/main/samples/circuit-app
- Add samples docs: https://zacsweers.github.io/metro/samples
- Add FAQ docs: https://zacsweers.github.io/metro/faq
Special thanks to @JoelWilcox, @bnorm, and @japplin for contributing to this release!
What's Changed
- Support qualifiers and implicit boundTypes in dagger-anvil rank interop by @JoelWilcox in #293
- Update plugin com.gradle.develocity to v4 by @renovate in #303
- Update dependency com.google.devtools.ksp to v2.1.20-2.0.0 by @renovate in #304
- Unify FIR predicate definitions by @JoelWilcox in #305
- Update okio to v3.11.0 by @renovate in #307
- Fix repeatable @ContributesTo annotations being missed when aggregating contributions from downstream modules by @JoelWilcox in #308
- Update dependency Markdown to v3.8 by @renovate in #310
- Start an FAQ doc by @ZacSweers in #315
- Optimize Map*Factory when empty by @ZacSweers in #317
- Add Circuit & Android samples by @ZacSweers in #311
- Disallow empty multibindings by default by @ZacSweers in #319
- Update circuit to v0.27.1 by @renovate in #320
- Update dependency mkdocs-material to v9.6.12 by @renovate in #326
- Update kotlinInject.anvil to v0.1.4 by @renovate in #325
- Update dagger to v2.56.2 - autoclosed by @renovate in #324
- Update plugin poko to v0.18.6 by @renovate in #323
- Check for overlapping/conflicting ancestor scopes by @ZacSweers in #322
- Generate per-scope hint overloads by @ZacSweers in #328
- Record lookups to included graph dep accessors by @ZacSweers in #329
- Support repeatable @ContributesBinding annotations with different scopes by @JoelWilcox in #321
- Issue 309 - Fix runtime class cast exception when interoping with javax provider by @japplin in #327
- Another test repeated ContributesBinding with different scopes and same bound type by @japplin in #212
Full Changelog: 0.1.2...0.1.3
0.1.2
- Enhancement: Implement
createGraph
andcreateGraphFactory
FIR checkers for better error diagnostics on erroneous type arguments. - Enhancement: Add
ContributesBinding.rank
interop support with Anvil. - Enhancement: Check Kotlin version compatibility. Use the
metro.version.check=false
Gradle property to disable these warnings if you're feeling adventurous. - Fix: Fix class-private qualifiers on multibinding contributions in other modules not being recognized in downstream graphs.
- Fix: Fix member injectors not getting properly visited in graph validation.
- Fix: Fix a bug where
Map<Key, Provider<Value>>
multibindings weren't always unwrapped correctly. - Fix: Fix
Map<Key, Provider<Value>>
type keys not correctly interpreting the underlying type key asMap<Key, Value>
. - Change: Change
InstanceFactory
to a value class. - Change: Make
providerOf
useInstanceFactory
under the hood.
Special thanks to @JoelWilcox, @bnorm, @japplin, @kevinguitar, and @erawhctim for contributing to this release!
What's Changed
- More doc updates by @ZacSweers in #273
- Add interop support for anvil ignoreQualifier by @japplin in #276
- Move Anvil tests to Kotlin test infrastructure by @bnorm in #277
- Fix typo in interop docs by @erawhctim in #283
- Misc small fixes by @ZacSweers in #286
- Fix member injector graph validation by @ZacSweers in #287
- Implement CreateGraphChecker by @ZacSweers in #290
- Add ContributesBinding.rank interop support by @JoelWilcox in #288
- Implement kotlin compatibility checks in Gradle by @ZacSweers in #291
- Include metro version in metadata by @ZacSweers in #292
- Update plugin spotless to v7.0.3 by @renovate in #296
- Improve ContextualTypeKey unwrapping by @ZacSweers in #298
- Update kotlinx-coroutines monorepo to v1.10.2 by @renovate in #299
- Remove KSP from the :compiler by @ZacSweers in #300
- Make InstanceFactory a value class by @ZacSweers in #297
- Fix map typekey resolution by @ZacSweers in #301
- Make providerOf use InstanceFactory under the hood by @ZacSweers in #302
New Contributors
- @erawhctim made their first contribution in #283
Full Changelog: 0.1.1...0.1.2
0.1.1
Initial release!
See the announcement blog post: https://www.zacsweers.dev/introducing-metro/