Maybe I ask what's up with anvil? I'm stuck with k...
# squarelibraries
u
Maybe I ask what's up with anvil? I'm stuck with kotlin 1.9 because of it (?)
n
You can follow this issue for updates and this post describes a configuration for using Anvil with K2. I think the last I saw it was mentioned there some unexpected API changes in the final Kotlin 2.0 release that broke some important APIs Anvil uses internally so they'll have to migrate to something else to fully support K2.
u
yea I was tracking it for months, there was a checklist for ksp to work etc etc .. okay so unexpected stuff, thanks
btw do you have a clue, is ksp work related to this? I though anvil was "broken" by the new kotlin, so the solution was to ditch the custom compiler plugin codegen and go the "standard" ksp route, i.e. dagger on ksp (which I think works in vanilla dagger) or am I totally off?
n
The blog post I linked to touched on that a bit. I don’t think they’re quite ready fully support KSP yet and I believe working on getting the compiler plugin to work as quicker solution with the long term goal to go full KSP.
u
I see, thanks!
noob question - gradle resolves transitive dependency versions to the biggest one of the requested, right? given kotlin 2.0.0 breaks anvil, that means if I'll include a dependnecy that transitively already depends on kotlin 2.0.0, it will break anvil, correct?
or will not do that if major is changed?
z
There’s unfortunately not an avenue to making the compiler plugin work as-is, the hooks it used to modify IR classes in-place is no longer supported in K2. My hope is that finishing component merging for KSP will more or less solve this
to speed things up, I’m continuing this work in a fork at github.com/zacsweers/anvil. Got module merging tests passing with KSP, next up is interface merging. Some things like subcomponent contributions and `@MergeModules`/`@MergeInterfaces` will probably come later as they’re either less used or have some awkwardness due to needing to generate intermediate classes
❤️ 6
hoping once interface merging and module merging are working though, I can start cutting preview releases for folks to test
👍 1
@ursus my blog post details the different 2.0 build scenarios you can do, transitive dependencies don’t really matter in this context because this is a build-time thing, not a runtime dependency thing.