Skip to content

Releases: square/anvil

v2.4.1

10 Jun 00:53
Compare
Choose a tag to compare

Changed

  • Attention: This version supports Kotlin 1.7.0 only. For Kotlin 1.6.* support please use version 2.4.1-1-6 instead. Future Anvil versions will remove support for Kotlin 1.6.

Fixed

  • Support wildcard imports for constants when resolving annotation arguments, see #592.
  • Fix dagger factory member injection not handling generics, see #486.
  • Correctly merge bindings from all scopes, if multiple @Merge* annotations are used, see #596.

Custom Code Generator

  • Change the method to get all super classes for ClassReference to return TypeReference instead.
  • Avoid a stackoverflow when querying all super types, see #587.
  • Create PropertyReference.Psi from primary constructor properties to have the same behavior as the descriptor implementation, see #609.

v2.4.0

29 Mar 00:14
Compare
Choose a tag to compare

Added

  • Anvil annotations are repeatable. Modules and bindings can now be contributed multiple times to different scopes. Multiple scopes can be merged in a single component, see #236.
  • Rewrote many of the internals of Anvil and as a result Anvil is up to 41% faster due to heavy caching of already parsed code structures.
  • Automatically publish snapshots for the main branch.
  • Documented Anvil's internal, see here.

Changed

  • Many of the internals of Anvil were rewritten and the non-stable APIs of the compiler-utils artifact have changed. Some highlights:
    • Instead of working with PSI or Descriptor APIs directly, you should work with the common ClassReference API.
    • ClassReference is a sealed class and either implemented with PSI or Descriptors, so it's easy to fallback to a specific API and add your own extensions.
    • The entry point to iterate through all classes used be classesAndInnerClass(module), use classAndInnerClassReferences() instead.

Removed

  • Removed support for Kotlin 1.5.
  • Removed deprecated APIs from the AnvilExtension in the gradle plugin.

Fixed

  • Filter duplicate generated properties, see #565.
  • Generate code for @ContributedSubcomponent when the trigger is created AFTER the contribution, see #478.
  • Properly parse the FqName if the type reference is an inner class, see #479.

v2.4.0-M2

15 Mar 19:00
Compare
Choose a tag to compare
v2.4.0-M2 Pre-release
Pre-release

Added

  • Made annotations repeatable. Modules and bindings can now be contributed multiple times to different scopes. Multiple scopes can be merged in a single component.

Fixed

  • Filter duplicate generated properties, see #565.

v2.4.0-M1

04 Mar 06:18
Compare
Choose a tag to compare
v2.4.0-M1 Pre-release
Pre-release

Added

  • Rewrote many of the internals of Anvil and as a result Anvil is up to 41% faster.
  • Automatically publish snapshots for the main branch.
  • Documented Anvil's internal, see here.

Removed

  • Removed support for Kotlin 1.5.
  • Removed deprecated APIs from the AnvilExtension in the gradle plugin.

Fixed

  • Generate code for @ContributedSubcomponents when the trigger is created AFTER the contribution, see #478.
  • Properly parse the FqName if the type reference is an inner class, see #479.

v2.3.11

28 Jan 19:34
Compare
Choose a tag to compare
  • Promote @ContributesSubcomponent to stable, see #474.
  • Support replacing @ContributesSubcomponent through a new replaces attribute, see #466.
  • Avoid duplicate bindings when a @ContributesSubcomponent uses a factory and is used in multiple parent components, see #459.
  • Fix rare duplicate bindings error for the same type with incremental compilation, see #460.
  • Support member injection for super types from different modules, see #438, #439 and #442.
  • Support custom CodeGenerators for AnvilCompilation. This makes it easier to unit-test specific scenarios, see #470.
  • Detect duplicated generated files (helpful for custom CodeGenerators), see #467.
  • Fix the import resolver for wildcard imports and inner classes, see #468.
  • Use Anvil version 2.3.11-1-6-10 if you use Kotlin 1.6.10. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.
    • Attention: This is the last release to simultaneously support Kotlin 1.5 and 1.6. The next release will only support Kotlin 1.6.

v2.3.10

24 Nov 21:08
Compare
Choose a tag to compare
  • New experimental annotation @ContributesSubcomponent to delay merging contributions until the parent component is created, see #160.
  • Add option to contribute class using @MergeInterfaces and @MergeModules to another scope with @ContributesTo.
  • Add a workaround for a bug in the Kotlin 1.6.0 compiler, see KT-49340.
  • Use Anvil version 2.3.10-1-6-0 if you want to test Kotlin 1.6.0. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.

v2.3.9

08 Nov 22:15
Compare
Choose a tag to compare
  • Add a workaround for AGP to sync generated sources with syncGeneratedSources, see #413.
  • Ignore functions with defaults in assisted factories, see #415.
  • Use Anvil version 2.3.9-1-6-0-RC2 if you want to test Kotlin 1.6.0-RC2. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.
  • Use Anvil version 2.3.9-1-6-0 if you want to test Kotlin 1.6.0. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.

v2.3.8

04 Nov 21:28
Compare
Choose a tag to compare
  • Add an option in the Anvil DSL syncGeneratedSources to sync generated sources in the IDE, see #412.
  • Fall back to PSI parsing for BindingModuleGenerator, see #310. (this allows you generated @ContributesBinding annotations in custom code generators)
  • Support generic supers for assisted factories when the assisted factory interface is generated, see #407.
  • Support generic type resolution in assisted factories, see #395. (regression in previous release)
  • Align TypeNames for assisted lambda arguments between descriptors and PSI, see #400. (regression in previous release)
  • Enable experimental Anvil APIs by default in the compiler testing utilities, see #398.
  • Make it easy the feed a compilation result to another Anvil compilation in the testing utilities, see #404.
  • Use Anvil version 2.3.8-1-6-0-RC2 if you want to test Kotlin 1.6.0-RC2. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.

v2.3.7

19 Oct 18:22
Compare
Choose a tag to compare
  • Allow configuring the KotlinCompilation when using the utilities to test custom code generators, see #386.
  • Support invariant and covariant type parameters properly, see #388.
  • Use Psi parsing for assisted factory generation, see #326.
  • Support assisted injection for deeply nested inner classes, see #394.
  • Use Anvil version 2.3.7-1-6-0-RC if you want to test Kotlin 1.6.0-RC. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.

v2.3.6

12 Oct 19:23
Compare
Choose a tag to compare
  • Support constant members in annotations properly, see #379.
  • Use Anvil version 2.3.6-1-6-0-RC if you want to test Kotlin 1.6.0-RC. Until Anvil hasn't adopted Kotlin 1.6 I'll publish additional versions that are required due to compiler API incompatibilities.