A Kotlin compiler plugin to make dependency injection with Dagger 2 easier.
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()
.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)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.
const
arguments in propagated annotation arguments (#940)@ContributesSubcomponent
generation until the last analysis rounds (#946)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.@Contributes___
annotation in a dependency module is now correctly deleted when there is a relevant change in the dependency module.projectDir
or binaryFile
as part of GeneratedFileCache
by @RBusarow in (#883)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:
# default is false
com.squareup.anvil.trackSourceFiles=true
// 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
1.9.22
(#814)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).