Replies: 1 comment 2 replies
-
Hey @bddckr ! Thank you so much for posting this discussion! It is definitely something worth addressing. TL;DR So a little background first. I started to develop this tool last year for a side project and as life got busy I shelved it until recently for another side project. By the time I had finished it I completely missed that another solution had been developed and in discussion. It was a great learning experience for me and I plan to maintain it for myself and others who wish to use it. However, From a technical perspective the libraries are nearly identical in functionality and have few API differences which shouldn't really impact the choice of one over the other. I should say that if you use slackhq/circuit it now has native support for Looking at the codegen between the libraries and your described use case it seems that both would behave in a similar way and suffer from the same issue. That being the potential to miss your generated code during the merging phase. Right now this would be the case for kimchi even with custom annotations and is something If my understanding of KSP is correct, and I'm not 100% that it is 😄, your generator would mostly be okay if you are generating in a module that is also not using a I think this is something that can be solved for your use case, but IMO not using an annotation makes the intent less clear and harder to maintain for others who might come across it. Where as marking it with an annotation makes the behavior more explicit and provides a cleaner solution to the problem outlined above. |
Beta Was this translation helpful? Give feedback.
-
Hey there, thanks for open-sourcing this!
I'm currently using Dagger 2 + Anvil and am looking for solutions to move my codebase to K2 and set the language version to 2.0.0 or later.
I've almost gotten https://github.com/ZacSweers/anvil to work with my codebase, but now that my custom code generator uses KSP, I'm re-evaluating the options. I'm interested in moving to https://github.com/evant/kotlin-inject. Not wanting to give up on what boilerplate removal Anvil brings, I've since found this project and https://github.com/amzn/kotlin-inject-anvil.
Do you have any thoughts on this project vs. Amazon's alternative?
Note: I'm just asking about obvious differences that are worth calling out. Don't dive deep or even properly review the other project, of course!
It looks like theirs works very similarly to how Zac Sweers's Anvil fork works - except, of course, it's for kotlin-inject and not Dagger 2. I'm interested in understanding the pros/cons. So far, it looks like kimchi is simple enough to use, and looking at the recent activity, it's not only actively maintained, but the changes are making it look like it's easy enough for a KSP newbie like myself to resolve issues myself and contribute in the long run, if required.
From a first look at the readmes only, it looks like both kimchi and Amazon's kotlin-inject-anvil work mostly the same. However, support for custom code generators seems easier to set up with kimchi.
My code generator doesn't use a custom annotation - I instead find all files to process based on a naming convention. Without setting it up yet, it seems kimchi will work just fine with that, as long as I don't break the multi-round processing of KSP (by e.g. raising an error, which would stop the processing after the current round finishes). Maybe kotlin-inject-anvil works fine with that as well, but I'd have to test that - the documentation makes it seem like it requires an annotation to be used.
Beta Was this translation helpful? Give feedback.
All reactions