Skip to content

Releases: square/anvil

v2.5.0-beta02

23 Feb 18:28
Compare
Choose a tag to compare
v2.5.0-beta02 Pre-release
Pre-release

Fixed

  • Binding supertype which is narrower than return type is wrongly allowed by @IlyaGulya in (#833)
  • Don't cache the projectDir or binaryFile as part of GeneratedFileCache by @RBusarow in (#883)
  • Add restored-from-cache, previously-generated files to analysis results after code generation by @RBusarow in (#882)

Other Notes & Contributions

v2.5.0-beta01

15 Feb 23:33
Compare
Choose a tag to compare
v2.5.0-beta01 Pre-release
Pre-release

Added

  • Incremental compilation and build caching fixes (#836)
    This feature is disabled by default.
    It can be enabled via a Gradle property or the Gradle DSL:

    Gradle Properties

    # default is false
    com.squareup.anvil.trackSourceFiles=true

    Gradle DSL

    // build.gradle[.kts]
    anvil {
      trackSourceFiles = true // default is false
    }
  • Configuration options can now be set via Gradle properties (#851)

    # ./gradle.properties
    com.squareup.anvil.addOptionalAnnotations=true
    com.squareup.anvil.disableComponentMerging=true
    com.squareup.anvil.generateDaggerFactories=true
    com.squareup.anvil.generateDaggerFactoriesOnly=true
    com.squareup.anvil.syncGeneratedSources=true
    com.squareup.anvil.trackSourceFiles=true

Changed

  • Upgrade Kotlin to 1.9.22 (#814)
  • don't leak Anvil's annotation artifacts to the target project's compile classpath (#822)
  • Update to dagger 2.50 (#830)

Removed

  • Drop Kotlin 1.8 support (#841)

Custom Code Generator

  • The GeneratedFile result type has been deprecated in favor of GeneratedFileWithSources. This new type allows for precise tracking of the generated files, which in turn drastically improves incremental compilation performance (#693).

Other Notes & Contributions

  • Support KSP in ContributesSubcomponentGenerator (#828)

v2.4.9

05 Jan 23:36
Compare
Choose a tag to compare

Changed

  • Upgrade Kotlin to 1.9.20

Fixed

  • Fix a configuration error related to version catalogs when building on Windows (#744)

Other Notes & Contributions

  • Use Anvil version 2.4.9-1-8 if your project is using Kotlin 1.8.x. This is also the last planned release with Kotlin 1.8.x support.

v2.4.8

07 Sep 22:42
Compare
Choose a tag to compare

Added

  • Anvil now provides an annotations-optional artifact for non-required annotations that we've found to be helpful with managing larger dependency graphs, including @SingleIn and @ForScope (#692).

Fixed

  • Support explicit API mode for complex map keys (#735).
  • Fix a bug where conflicting imports could be generated (#738).
  • Fix suspend lambda parameters not being supported (#745).

Other Notes & Contributions

  • Thanks to @gabrielittner and @bddckr for contributing to this release.
  • Use Anvil version 2.4.8-1-8 if your project is using Kotlin 1.8.x.

v2.4.7

29 Jul 01:14
Compare
Choose a tag to compare

Changed

  • Upgrade to Kotlin 1.9.0 as the primary supported version
  • Upgrade to Kotlin 1.8.22 for dual-release artifacts. Use Anvil version 2.4.7-1-8 if your project is using Kotlin 1.8.x.
  • Upgrade to Dagger 2.46.1
  • Upgrade to kotlinx-metadata 0.6.2

v2.4.6

25 May 21:26
Compare
Choose a tag to compare

Changed

  • Upgrade KotlinPoet to 1.13.0 and fix bug uncovered by new TypeName#equals/hashCode changes, see #699.
  • Upgrade Kotlin to 1.8.21.

v2.4.5

06 Apr 23:20
Compare
Choose a tag to compare

Changed

  • Raise minimum Kotlin version to 1.8.20.
  • Raise minimum AGP version to 7.1.0.
  • The Kotlin Gradle Plugin (both the core plugin and the API artifact) are no longer a dependency of the Anvil Gradle Plugin. Instead, it's now a compileOnly dependency, allowing the plugin to defer to whatever version the user already has. If you were accidentally depending on KGP through Anvil, you'll need to explicitly add the plugin yourself now.

Removed

  • Support for the old compiler backend. The Java stub generating task uses the new backend by default since Kotlin 1.8.20.

Fixed

  • Fix duplicate generated binding method names. If a class contributes multiple bindings and the bound types have the same short name, then Anvil would generate methods with duplicate names that clash in the end.
  • Support Any as bound type when using @ContributesBinding or @ContributesMultibinding, see #680.

Custom Code Generator

  • Add option to change the JVM target when testing code generators with the custom AnvilCompilation class, see #682.

v2.4.4

12 Jan 23:51
Compare
Choose a tag to compare

Added

  • Added support for Kotlin 1.8.

Changed

  • The issue that required disabling precise Java tracking is not needed anymore. The workaround has been removed.

Removed

  • Remove support for Kotlin 1.7. Anvil only supports Kotlin 1.8 moving forward.

Custom Code Generator

  • Add ability to query top-level functions and properties. The entry point is projectFiles.topLevelFunctionReferences(module) and projectFiles.topLevelPropertyReferences(module). This allows you write code generators reacting to top-level functions and properties and not only classes, see #644.
  • The FunctionReference type has been renamed to MemberFunctionReference and a new super type FunctionReference has been introduced for TopLevelFunctionReference and MemberFunctionReference.
  • The PropertyReference type has been renamed to MemberPropertyReference and a new super type PropertyReference has been introduced for TopLevelPropertyReference and MemberPropertyReference.

v2.4.3

16 Dec 22:18
Compare
Choose a tag to compare

Added

  • Add support for generating MapKeyCreator classes when generating Dagger factories, see #651.
  • @Binds methods are now validated for correctness when generating Dagger factories, see #649.

Changed

  • Upgrade Kotlin to 1.7.20 and Gradle to 7.5.1, see #643.
  • For Kotlin 1.8.x releases, we now use a fork of kotlin-compile-testing: dev.zacsweers.kctfork:core:0.1.0-1.8.0-Beta01.
  • Use Anvil version 2.4.3-1-8-0-RC if you want to test Kotlin 1.8.0-RC. Until Anvil has fully adopted Kotlin 1.8 we'll publish additional versions that are required due to compiler API incompatibilities.

Fixed

  • Fix resolving types whose packages are wrapped in backticks, see #665.
  • Fix resolving types when paired with qualifiers, see #664.
  • Fix inconsistency between Dagger and Anvil for generated factory names involving a dash-separated module name, see #653.
  • Fix resolving types whose names are wrapped in backticks, see #641.
  • Update outdated documentation on incremental compilation limitations, see #637.

v2.4.2

23 Aug 17:35
Compare
Choose a tag to compare

Removed

  • Remove support for Kotlin 1.6. Anvil only supports Kotlin 1.7 moving forward.

Fixed

  • Upgraded KotlinPoet to the latest version to fix potential conflicts with other libraries, see #613.
  • When resolving FqNames check the inner class hierarchy for the right reference, see #617.
  • An imported top level function should not be considered a class.
  • Support star projections for wrapped type references, see #620.
  • Support contributing types with Any as boundType, see #619.
  • Improve the error message for contributed inner classes, see #616.
  • Don't share the output directory for the DisableIncrementalCompilationTask, if there are multiple Kotlin compilation tasks for the same module, see #602.
  • Unwrap types from type aliases for TypeReference, see #611.
  • Remove incremental compilation workaround, see #627.
  • Fix annotation arguments using string templates not being parsed correctly, see #631.
  • Align Anvil with Dagger and don't support member injection for private fields, see #341.