2.5.0-beta01 - 2024-02-14
- Incremental compilation and build caching fixes (#836)
- Configuration options can now be set via Gradle properties (#851)
- 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)
- Drop Kotlin 1.8 support (#841)
- The
GeneratedFileresult 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).
- Support KSP in ContributesSubcomponentGenerator (#828)
2.4.9 - 2024-01-05
- Upgrade Kotlin to
1.9.20
- Fix a configuration error related to version catalogs when building on Windows (#744)
- Use Anvil version
2.4.9-1-8if your project is using Kotlin1.8.x. This is also the last planned release with Kotlin1.8.xsupport.
2.4.8 - 2023-09-07
- Anvil now provides an
annotations-optionalartifact for non-required annotations that we've found to be helpful with managing larger dependency graphs, including@SingleInand@ForScope(#692).
- 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).
- Thanks to @gabrielittner and @bddckr for contributing to this release.
- Use Anvil version
2.4.8-1-8if your project is using Kotlin1.8.x.
2.4.7 - 2023-07-28
- Upgrade to Kotlin
1.9.0as the primary supported version - Upgrade to Kotlin
1.8.22for dual-release artifacts. Use Anvil version2.4.7-1-8if your project is using Kotlin1.8.x. - Upgrade to Dagger
2.46.1 - Upgrade to kotlinx-metadata
0.6.2
2.4.6 - 2023-05-25
- Upgrade KotlinPoet to
1.13.0and fix bug uncovered by new TypeName#equals/hashCode changes, see #699. - Upgrade Kotlin to
1.8.21.
2.4.5 - 2023-04-06
- 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
compileOnlydependency, 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.
- Support for the old compiler backend. The Java stub generating task uses the new backend by default since Kotlin 1.8.20.
- 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
Anyas bound type when using@ContributesBindingor@ContributesMultibinding, see #680.
- Add option to change the JVM target when testing code generators with the custom
AnvilCompilationclass, see #682.
2.4.4 - 2023-01-12
- Added support for Kotlin 1.8.
- The issue that required disabling precise Java tracking is not needed anymore. The workaround has been removed.
- Remove support for Kotlin 1.7. Anvil only supports Kotlin 1.8 moving forward.
- 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
FunctionReferencetype has been renamed toMemberFunctionReferenceand a new super typeFunctionReferencehas been introduced forTopLevelFunctionReferenceandMemberFunctionReference. - The
PropertyReferencetype has been renamed toMemberPropertyReferenceand a new super typePropertyReferencehas been introduced forTopLevelPropertyReferenceandMemberPropertyReference.
- We received a report from one project that there were issues with using Dagger 2.42 with this release. You may need to use Dagger 2.44+ when upgrading to Anvil 2.4.4.
2.4.3 - 2022-12-16
- Add support for generating MapKeyCreator classes when generating Dagger factories, see #651.
@Bindsmethods are now validated for correctness when generating Dagger factories, see #649.
- Upgrade Kotlin to
1.7.20and Gradle to7.5.1, see #643. - For Kotlin
1.8.xreleases, 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-RCif you want to test Kotlin1.8.0-RC. Until Anvil has fully adopted Kotlin1.8we'll publish additional versions that are required due to compiler API incompatibilities.
- 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.
2.4.2 - 2022-08-23
- Remove support for Kotlin 1.6. Anvil only supports Kotlin 1.7 moving forward.
- 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
AnyasboundType, 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.
2.4.1 - 2022-06-09
- Attention: This version supports Kotlin
1.7.0only. For Kotlin1.6.*support please use version2.4.1-1-6instead. Future Anvil versions will remove support for Kotlin 1.6.
- 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.
- Change the method to get all super classes for
ClassReferenceto returnTypeReferenceinstead. - Avoid a stackoverflow when querying all super types, see #587.
- Create
PropertyReference.Psifrom primary constructor properties to have the same behavior as the descriptor implementation, see #609.
2.4.0 - 2022-03-28
- 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
mainbranch. - Documented Anvil's internal, see here.
- Many of the internals of Anvil were rewritten and the non-stable APIs of the
compiler-utilsartifact have changed. Some highlights:- Instead of working with PSI or Descriptor APIs directly, you should work with the common
ClassReferenceAPI. ClassReferenceis 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), useclassAndInnerClassReferences()instead.
- Instead of working with PSI or Descriptor APIs directly, you should work with the common
- Removed support for Kotlin
1.5. - Removed deprecated APIs from the
AnvilExtensionin the gradle plugin.
- Filter duplicate generated properties, see #565.
- Generate code for
@ContributedSubcomponentwhen the trigger is created AFTER the contribution, see #478. - Properly parse the
FqNameif the type reference is an inner class, see #479.
2.4.0-M2 - 2022-03-015
- Made annotations repeatable. Modules and bindings can now be contributed multiple times to different scopes. Multiple scopes can be merged in a single component.
- Filter duplicate generated properties, see #565.
2.4.0-M1 - 2022-03-03
- Rewrote many of the internals of Anvil and as a result Anvil is up to 41% faster.
- Automatically publish snapshots for the
mainbranch. - Documented Anvil's internal, see here.
- Removed support for Kotlin
1.5. - Removed deprecated APIs from the
AnvilExtensionin the gradle plugin.
- Generate code for
@ContributedSubcomponents when the trigger is created AFTER the contribution, see #478. - Properly parse the
FqNameif the type reference is an inner class, see #479.
2.3.11 - 2022-01-28
- Promote
@ContributesSubcomponentto stable, see #474. - Use Anvil version
2.3.11-1-6-10if you use Kotlin1.6.10. Until Anvil hasn't adopted Kotlin1.6I'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.
- Support replacing
@ContributesSubcomponentthrough a newreplacesattribute, see #466. - Support member injection for super types from different modules, see #438, #439 and #442.
- Support custom
CodeGenerators forAnvilCompilation. This makes it easier to unit-test specific scenarios, see #470. - Detect duplicated generated files (helpful for custom
CodeGenerators), see #467.
- Avoid duplicate bindings when a
@ContributesSubcomponentuses 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.
- Fix the import resolver for wildcard imports and inner classes, see #468.
2.3.10 - 2021-11-24
- New experimental annotation
@ContributesSubcomponentto delay merging contributions until the parent component is created, see #160. - Add option to contribute class using
@MergeInterfacesand@MergeModulesto 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-0if you want to test Kotlin1.6.0. Until Anvil hasn't adopted Kotlin1.6I'll publish additional versions that are required due to compiler API incompatibilities.
2.3.9 - 2021-11-08
- 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-RC2if you want to test Kotlin1.6.0-RC2. Until Anvil hasn't adopted Kotlin1.6I'll publish additional versions that are required due to compiler API incompatibilities. - Use Anvil version
2.3.9-1-6-0if you want to test Kotlin1.6.0. Until Anvil hasn't adopted Kotlin1.6I'll publish additional versions that are required due to compiler API incompatibilities.
2.3.8 - 2021-11-04
- Add an option in the Anvil DSL
syncGeneratedSourcesto sync generated sources in the IDE, see #412. - Fall back to PSI parsing for
BindingModuleGenerator, see #310. (this allows you generated@ContributesBindingannotations 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
TypeNamesfor 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-RC2if you want to test Kotlin1.6.0-RC2. Until Anvil hasn't adopted Kotlin1.6I'll publish additional versions that are required due to compiler API incompatibilities.
2.3.7 - 2021-10-19
- Allow configuring the
KotlinCompilationwhen 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-RCif you want to test Kotlin1.6.0-RC. Until Anvil hasn't adopted Kotlin1.6I'll publish additional versions that are required due to compiler API incompatibilities.
2.3.6 - 2021-10-12
- Support constant members in annotations properly, see #379.
- Use Anvil version
2.3.6-1-6-0-RCif you want to test Kotlin1.6.0-RC. Until Anvil hasn't adopted Kotlin1.6I'll publish additional versions that are required due to compiler API incompatibilities.
2.3.5 - 2021-10-06
- Upgraded Anvil to Kotlin
1.5.31. - Use correct setter name for members in generated factories, see #362.
- Handle the special case of injecting a
Provider<Lazy<Type>>properly for member injection, see #365. - Make sure in JVM modules that the configuration
anvilMainextendsanvilso that code generators are picked up, see #368. - Support member injection for super classes, see #343.
- Prefer Kotlin collection types when Java collections are imported through a star import, see #371.
2.3.4 - 2021-08-27
- Upgraded Anvil to Kotlin
1.5.21. - Properly inject members when property setters are annotated, see #340.
- Properly inject members when using assisted injection, see #342.
- Don't generate a singleton factory (object), if the class with the inject constructor has any type parameter, see #348.
- Look for star imports before checking imports from the Kotlin package. Star imports have a higher priority, see #358.
- Handle the special case of injecting a
Provider<Lazy<Type>>properly, see #344.
2.3.3 - 2021-06-23
- Fix a bug in the Gradle plugin that accidentally realized all tasks in the module instead of evaluating them lazily, see #330.
2.3.2 - 2021-06-15
- Remove an accidental required dependency on the Android Gradle Plugin, see #323.
- Ensure that excluded bindings and modules are only excluded for the specific component that merges a scope and not all components merging the same scope, see #321.
- Disable precise Java tracking for the stub generating Kotlin compilation task when needed, see #324.
2.3.1 - 2021-06-09
- Ignore replaced bindings/modules from excluded bindings/modules, see #302.
- Create separate Anvil configurations for each build type, see #307.
- Introduce a new VariantFilter for the Gradle extension. This API allows you to enable and disable Anvil for specific variants. Allow to override
generateDaggerFactories,generateDaggerFactoriesOnlyanddisableComponentMergingthrough the variant filter, see #100.
2.3.0 - 2021-06-02
- Add option to extend Anvil with your own
CodeGenerator, see here and #265. - Use Gradle Property APIs in the Anvil extension. This is a source-breaking change (but binary-compatible) for Kotlin and .kts consumers of the Anvil Gradle plugin, see #284.
- Upgrade Anvil to Kotlin
1.5.10. The old legacy compiler backend is still supported and the IR backend not required yet.
2.2.3 - 2021-05-25
- Support the JVM and Android targets for Kotlin Multiplatform projects, see #222.
- Add a generation only mode for Anvil in order to avoid performance penalties when still using KAPT in the same module, see #258.
- Respect qualifiers when checking whether there is a duplicate binding, see #270.
2.2.2 - 2021-05-16
- Handle inner generic classes in factories for constructor injection properly, see #244.
- Generate a correct factory when a class has both constructor and member injection, see #246.
- Make generated assisted factories match interface function names, see #252.
- Fix a parsing error for inner class reference expressions, see #256.
- Verify that the qualifier is added to generated methods for member injection, see #264.
2.2.1 - 2021-04-09
- Fix problematic check for Kotlin annotations, see #232.
- Handle Lazy assisted parameters properly in generated assisted factories.
- Build and test Anvil with Kotlin 1.5.0-M2 in CI.
2.2.0 - 2021-03-17
@ContributesBindingsupports qualifiers now, see the README and documentation for examples.- You can generate multibindings with
@ContributesMultibindingnow, see the README and documentation for examples, see #152. - Upgrade Dagger to
2.32. Generating factories for assisted injection is no longer compatible with older Dagger versions due to the behavior change in Dagger itself. Make sure to use Dagger version2.32or newer in your project, too. @ContributesBindinghas a priority field now for cases where you don't have access to replaced bindings at compile time, see #161.- Use the mangled function name to generate the factory for a provider method.
- Handle fully qualified names with type parameters for Dagger factories properly, see #198.
- Support classes in the root package and don't crash, see #227.
2.1.0 - 2021-02-05
- This release upgrades Anvil to Kotlin
1.4.30. Older Kotlin version are no longer supported moving forward. - The IR extension is enabled by default. Anvil is compatible with the new IR and old compiler backend.
2.0.14 - 2021-02-04
- Anvil falsely detected provider methods inside of companion objects of interfaces as abstracted, see #187.
- Support nullable parameters for assisted injection properly, see #189.
2.0.13 - 2021-02-04
- This release accidentally used a Kotlin preview version.
2.0.12 - 2021-02-02
- Support Dagger's assisted injection feature and generate necessary code, see #165.
- Throw an error if a provider method is abstract, see #183.
2.0.11 - 2020-12-28
- Declare the Dagger Factory generation option as stable.
- Support a mode that only generates Dagger Factories through the
generateDaggerFactoriesOnlyflag, see #164. - Suppress any deprecation warnings in generated code, see #169.
2.0.10 - 2020-11-20
- Upgrade Kotlin to
1.4.20. Note that this version no longer works with Kotlin1.4.10or older, see #159.
2.0.9 - 2020-11-20
- Upgrade Kotlin to
1.4.10. Note that this release is not compatible with Kotlin1.4.20. - Remove the usage of the now deprecated
KotlinGradleSubpluginclass, see #30. - Enable Kotlin's explicit API mode in the
:annotationsartifact.
2.0.8 - 2020-11-12
- Support Kotlin's explicit API mode in generated code, see #144.
- Handle packages starting with an uppercase letter properly, see #150.
- Use the correct import if an uppercase function is imported with the same name as the type, see #154.
- Support properties as providers in Dagger modules, see #149.
2.0.7 - 2020-11-12 [YANKED]
- DO NOT USE! This version was compiled with the wrong Kotlin version.
2.0.6 - 2020-10-06
- Support constructor injection for classes with bounded types, see #126.
- Print a better error message for Dagger provider methods with implicit return types, see #124.
- Fix another instance of absolute paths as task inputs, see #65.
- Use lazy APIs in the Gradle plugin for task configuration avoidance.
- Handle named imports correctly, see #137.
2.0.5 - 2020-09-18
- Support type parameters for @Inject constructors, see #111.
- Handle named imports properly, see #115.
- Fix a bug for Gradle's experimental configuration caching feature, see #113.
- Implement an extension for the new Kotlin IR backend. This extension will ship with Kotlin 1.4.20, see #11.
- Build the project and run tests in CI with JDK 11.
- Preserve variance keywords when generating factory classes, see #120.
2.0.4 - 2020-09-18 [YANKED]
- Ignore, this release was built with Kotlin 1.4.20 accidentally.
2.0.3 - 2020-09-08
- Support classes with multiple generic parameters for field injection, see #91.
- Fix missing Factory class when Anvil generates them,
@MergeModulesis used and a Kotlin object uses@ContributesBindingin the dependency graph. - Fix absolute paths in Kapt tasks, see #65.
- Similar to Dagger throw an error if provider names clash, see #99.
- Verify that the replacement and exclusion mechanism is only used within the same scope, see #107.
- Rework how imports are resolved for generated code. That should fix problems around inner classes #97 and avoid unused imports #82.
2.0.2 - 2020-09-01
- Support using
@ContributesBindingfor objects and generate a@Providesrather than a@Bindsfunction. - Allow using Anvil to generate Dagger factories in modules using
@Subcomponent, see #74. - Reduce the size of the generated bytecode in certain scenarios, see #76.
- Stop adding the
@Generatedannotation. This leads to issues on Android where this annotation doesn't exist, see #75. - Support classes starting with a lowercase character, see #80.
- Support generic classes using field injection, see #91.
- Add missing import for inject constructor factories when the injected type is an inner class, see #79.
2.0.1 - 2020-08-27
- Throw a compilation error when a
@ContributesBindingannotation binds a generic type. - Remove absolute paths in Kotlin compilation task inputs #65.
- Add new experimental feature to generate Dagger factories for faster build times.
2.0.0 - 2020-08-07
- Change the
replacesattribute from a single class to an array. This gives the API more flexibility and avoids redundant classes. E.g. one Dagger module with several binding and provider methods may wish to replace multiple other Dagger modules. - Introduce the new
@ContributesBindingannotation. This annotation allows you to contribute binding methods without actually writing a Dagger module.interface Authenticator @ContributesBinding(AppScope::class) class RealAuthenticator @Inject constructor() : Authenticator // The generated and automatically included Dagger module would look similar like this: @Module @ContributesTo(AppScope::class) abstract class AuthenticatorModule { @Binds abstract fun bindRealAuthenticator(authenticator: RealAuthenticator): Authenticator }
- Support nested classes for contributed Dagger modules and component interfaces if the outer class uses a different scope #45.
1.0.6 - 2020-07-29
- Add the annotation artifact as an
implementationdependency instead ofapi#40. - Remove the strong dependency on the Android Gradle Plugin and allow Anvil to be used in pure JVM modules #39.
- Note: This version is compatible with Kotlin
1.3.72and1.4.0-rc. The bug that required special builds for the 1.4 milestone releases was fixed.
1.0.5-1.4-M3 - 2020-07-24
- Renamed the project from Hephaestus to Anvil #12. IMPORTANT: Anvil is not compatible with Hephaestus and you must upgrade the plugin in all of your libraries. The artifact coordinates changed, too.
- Same as
1.0.5, only built with Kotlin 1.4-M3.
1.0.5 - 2020-07-24
- Renamed the project from Hephaestus to Anvil #12. IMPORTANT: Anvil is not compatible with Hephaestus and you must upgrade the plugin in all of your libraries. The artifact coordinates changed, too.
1.0.4-1.4-M3 - 2020-07-24
- Ensure that types cannot be included and excluded at the same time, which leads to unexpected results.
- Fix a classpath issue in the Gradle plugin when using the new plugin syntax #31.
- Same as
1.0.4, only built with Kotlin 1.4-M3.
1.0.4 - 2020-07-24
- Ensure that types cannot be included and excluded at the same time, which leads to unexpected results.
- Fix a classpath issue in the Gradle plugin when using the new plugin syntax #31.
1.0.3-1.4-M3 - 2020-07-17
- Bug fix for Gradle's configuration caching #29.
- Same as
1.0.3, only built with Kotlin 1.4-M3.
1.0.3 - 2020-07-17
- Bug fix for Gradle's configuration caching #29.
1.0.2 - 2020-07-17 [YANKED]
- Discarded
1.0.1 - 2020-07-09
- Added support for Gradle's configuration caching and made task configuration lazy #19.
- Fixed the implicit requirement to apply plugins in a specific order #8 #16.
- Fixed file path issues on Windows #13 #24.
- Allow Dagger modules that are interfaces #14 #24.
- Test Hephaestus with Kotlin
1.4and1.4.2. - Use
1.0.1-1.4-M3to use Hephaestus in projects with Kotlin 1.4-M3.
1.0.0 - 2020-06-16
- Initial release.