Releases: square/anvil
Releases · square/anvil
v2.5.0-beta02
Fixed
- Binding supertype which is narrower than return type is wrongly allowed by @IlyaGulya in (#833)
- Don't cache the
projectDir
orbinaryFile
as part ofGeneratedFileCache
by @RBusarow in (#883) - Add restored-from-cache, previously-generated files to analysis results after code generation by @RBusarow in (#882)
Other Notes & Contributions
- @IlyaGulya made their first contribution in (#833)
v2.5.0-beta01
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 ofGeneratedFileWithSources
. 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
v2.4.8
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 Kotlin1.8.x
.
v2.4.7
Changed
- Upgrade to Kotlin
1.9.0
as the primary supported version - Upgrade to Kotlin
1.8.22
for dual-release artifacts. Use Anvil version2.4.7-1-8
if your project is using Kotlin1.8.x
. - Upgrade to Dagger
2.46.1
- Upgrade to kotlinx-metadata
0.6.2
v2.4.6
v2.4.5
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
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)
andprojectFiles.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 toMemberFunctionReference
and a new super typeFunctionReference
has been introduced forTopLevelFunctionReference
andMemberFunctionReference
. - The
PropertyReference
type has been renamed toMemberPropertyReference
and a new super typePropertyReference
has been introduced forTopLevelPropertyReference
andMemberPropertyReference
.
v2.4.3
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 to7.5.1
, see #643. - For Kotlin
1.8.x
releases, we now use a fork ofkotlin-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 Kotlin1.8.0-RC
. Until Anvil has fully adopted Kotlin1.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
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
FqName
s 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
asboundType
, 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.