Skip to content

Releases: ZacSweers/metro

0.3.3

26 May 15:52
Compare
Choose a tag to compare
  • 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

Full Changelog: 0.3.2...0.3.3

0.3.2

15 May 16:26
Compare
Choose a tag to compare
  • 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

13 May 23:47
Compare
Choose a tag to compare
  • 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

05 May 05:23
Compare
Choose a tag to compare
  • 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 be private. This is enabled by defaults and supersedes the publicProviderSeverity when enabled, and can be disabled via the Gradle extension or transform-providers-to-private compiler option. Note that properties and providers with any annotations with KClass 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 a public 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

New Contributors

Full Changelog: 0.2.0...0.3.0

0.2.0

22 Apr 04:06
Compare
Choose a tag to compare
  • 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

19 Apr 03:21
Compare
Choose a tag to compare
  • 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 and metro.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 print example.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 or Lazy 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

08 Apr 15:49
Compare
Choose a tag to compare
  • Enhancement: Implement createGraph and createGraphFactory 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 as Map<Key, Value>.
  • Change: Change InstanceFactory to a value class.
  • Change: Make providerOf use InstanceFactory under the hood.

Special thanks to @JoelWilcox, @bnorm, @japplin, @kevinguitar, and @erawhctim for contributing to this release!

What's Changed

New Contributors

Full Changelog: 0.1.1...0.1.2

0.1.1

03 Apr 16:17
Compare
Choose a tag to compare

Initial release!

See the announcement blog post: https://www.zacsweers.dev/introducing-metro/