anvil
anvil copied to clipboard
Auto wire KSP when running in KSP mode
This propagates values from AnvilExtension to KSP args automatically when KSP mode is enabled, easing use in projects. Otherwise, KSP processors end up being inert since they require reading an AnvilContext from these args. This also automatically adds the Anvil compiler to the corresponding KSP configuration.
Most of this logic is adapted from what's been working well in Moshi-IR's plugin: https://github.com/ZacSweers/MoshiX/blob/main/moshi-ir/moshi-gradle-plugin/src/main/kotlin/dev/zacsweers/moshix/ir/gradle/MoshiGradleSubplugin.kt#L30-L69