Extending Anvil for Fun and Profit
Jul 20, 2021

Summary
This post details the extension of Anvil's compiler API to automatically generate Dagger wiring code for Activities. It introduces a custom `CodeGenerator` that hooks into the compiler to detect `@InjectWith` annotations and generate `AnvilInjector` and `InjectorBinder` classes. This eliminates manual boilerplate for Activity injection and removes the need for `dagger-android-processor` and kapt for this specific use case, further reducing build times.