Plugging into Anvil and powering up your dependency injection
summary
Explains extending Anvil with a custom code generator that reads Kotlin PSI, uses KotlinPoet to emit merge subcomponents and parent interfaces, and registers a feature injector via Dagger multibindings. Claims: migration of ~600 modules and ~500 features, sample apps auto-wire via Anvil, and a measured ~13% clean / ~15% incremental build speedup after replacing kapt/Java stubs. Shows handling factory specs (constructor args), working around Anvil’s generic multibinding limitation, and returning a scoped component holder for runtime use.
AI-written summary · about
chapters (7)
- 0:00Introduction
- 4:22Legacy Dagger setup
- 7:35Anvil overview
- 15:30Anvil plugin API
- 20:53Building custom plugins
- 35:17Real-world examples
- 39:55Results and benefits
related talks
45mFuture of Dependency Injection
40mNavigating Dependency Injection with Metro
48mDemystifying Dagger
42m(Unofficial) Guide to App Architecture Guide Vol. 2
28mThe Lazy (Meta)programmer's Guide to Hilt Extensions
39mInject Basics!
45mDagger 2 - Back to Basics
33mProducer-Consumer Linking at the Bytecode Level
