Skip to content

Releases: square/anvil

v2.5.0-beta09

09 May 22:16
Compare
Choose a tag to compare
v2.5.0-beta09 Pre-release
Pre-release

Deprecated

  • ClassName.generateClassName() and ClassReference.generateClassName() have been renamed to __.joinSimpleNames() for the sake of clarity. The ClassName version has also moved packages, so its new fully qualified name is com.squareup.anvil.compiler.internal.joinSimpleNames.
  • ClassName.generateClassNameString() has been renamed/moved to com.squareup.anvil.compiler.internal.generateHintFileName().

Fixed

  • Anvil will now attempt to shorten the names of hint files, generated "merged" subcomponents, and contributed binding modules so that all file names derived from them will have 255 characters or fewer.

v2.5.0-beta08

01 May 17:39
Compare
Choose a tag to compare
v2.5.0-beta08 Pre-release
Pre-release

Changed

  • Anvil's generated hints are now all generated to the same anvil.hint package, which simplifies hint lookups and better future-proofs future KSP work. Note that this is a user-invisible change, but it will require a one-time recompilation of any Anvil-generated hints. (#975)

Fixed

  • cache generated file paths relative to the build directory (changed from project directory) (#979)
  • check both kapt and ksp for dagger-compiler when using KSP (#989)

v2.5.0-beta07

16 Apr 22:43
Compare
Choose a tag to compare
v2.5.0-beta07 Pre-release
Pre-release

Fixed

  • Another mangled name workaround in KSP (#966)

v2.5.0-beta06

16 Apr 16:49
Compare
Choose a tag to compare
v2.5.0-beta06 Pre-release
Pre-release

Deprecated

  • ContributesBinding.priority has been deprecated in favor of the int-value-based ContributesBinding.rank. This allows for more granular prioritization, rather than just the three enum entries that ContributesBinding.Priority offered.

Important

IDE auto-replace can auto-replace the enum entry with the corresponding integer, but not the named argument. Automatically-migrated code may wind up with something like priority = RANK_NORMAL. This is an IntelliJ limitation.

Removed

Fixed

  • pass files with only top-level function/property declarations to CodeGenerator implementations (#956)
  • rename the new int-based priority to rank, restore the enum to priority (#957)
  • Fix private targets API use (#961)
  • Fix KSP2 fallback in mangle name checks (#962)
  • Simplify redundant logic (#963)

v2.5.0-beta05

09 Apr 18:33
Compare
Choose a tag to compare
v2.5.0-beta05 Pre-release
Pre-release

Added

Fixed

  • fix interface based @ContributesSubcomponent.Factory in KSP by @gabrielittner (#931)
  • Fix KSP resolution of Priority (#933)
  • Gracefully handle module name resolution in KSP (#947)
  • Always generate provider factories for binding modules (#951)
  • use the resolved value of const arguments in propagated annotation arguments (#940)
  • re-run analysis between an incremental sync and code generation (#943)
  • delay @ContributesSubcomponent generation until the last analysis rounds (#946)

Dependencies

  • Update dependency gradle to v8.7 (#937)
  • Update dagger to v2.51.1 (#944)

v2.5.0-beta04

14 Mar 22:43
Compare
Choose a tag to compare
v2.5.0-beta04 Pre-release
Pre-release

Changed

  • Interface merging is now done in the IR backend, improving performance and future compatibility with K2.
  • Update Dagger to 2.51.
  • @ContributesBinding and @ContributesMultibinding have been completely reworked to a new implementation that generates one binding dagger module for each contributed binding. While not an ABI-breaking change, this does change the generated code and requires users to re-run Anvil's code gen over any projects contributing bindings in order to be merged with the new implementation.

Fixed

  • Code generated because of a @Contributes___ annotation in a dependency module is now correctly deleted when there is a relevant change in the dependency module.
  • Nested interfaces and modules can now be contributed to enclosing classes.

v2.5.0-beta03

26 Feb 23:24
Compare
Choose a tag to compare
v2.5.0-beta03 Pre-release
Pre-release

Fixed

  • Don't fail the build when a @Binds-annotated function binds a generic type (#885)
    • This is a revert of the changes in (#833).

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.