question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interoperation with Hilt - Ability to get rid of kapt in most modules

See original GitHub issue

README clearly states that Anvil is not needed with Hilt, since Hilt already includes all Anvil’s features.

However, Anvil has one huge advantage over Hilt: It does not use kapt, which makes it much lighter on the build speed.

Would it be possible to have Anvil’s ContributesTo interop with Hilt’s InstallIn? Most modules in our project only use @Module and @Inject. If Anvil would support that, we could get rid of Hilt annotation processor in most modules and only rely on lighter Anvil.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
vRallevcommented, Mar 1, 2021

There are no plans right now to improve interop. However, you might be able to use Anvil to some part. You could use Anvil’s ContributesTo and then use [@MergeModules](https://github.com/square/anvil/blob/main/annotations/src/main/java/com/squareup/anvil/annotations/compat/MergeModules.kt) and this module you InstallIn in Hilt’s graph. You can do the same with [@MergeInterfaces](https://github.com/square/anvil/blob/main/annotations/src/main/java/com/squareup/anvil/annotations/compat/MergeInterfaces.kt). I’ve never tested it myself, but it could work.

1reaction
vRallevcommented, Aug 13, 2022

No, there’s no way except for you to create your own Kotlin compiler plugin and modify the source code (similar to what Anvil does in the compiler backend).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hilt in multi-module apps - Android Developers
Declare an @EntryPoint interface in the app module (or in any other module that can be processed by Hilt) with the dependencies that...
Read more >
Migrating to Hilt - Dagger
As your migration continues, you should be able to remove these methods and have calling code use the Hilt EntryPoints API directly.
Read more >
Space-by-Time Modular Decomposition Effectively Describes ...
The modular control hypothesis suggests that motor commands are built from precoded modules whose specific combined recruitment can allow ...
Read more >
Unintended Behaviour | Unload / loadModules in Hilt
The idea is simple, I want to throw away all my memory caches, related to the user, when the user logs out. I...
Read more >
utilization so as to maximize:productivity, by relieving ... - ERIC
competency-based teacher education programsa most difficult task. ... instructional modules. WK: And the project gave us an opportunity to have a program.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found