koin-annotations
koin-annotations copied to clipboard
Allow extendability (plugin support?)
Is your feature request related to a problem? Please describe. I am developing a ksp processor for generating a koin module from ktorfit declarations. https://github.com/dshatz/ktorfit-koin
The user creates a class:
@ServiceModule(scan="com.example.services")
class NetworkModule
My library generates:
val NetworkModule.module: Module = networkModule
val networkModule = module {
// all ktorfit services discovered by my ksp processor.
}
Then, import the generated module into a normal Koin module.
@Module(includes=[NetworkModule::class])
class AppModule
The problem is that koin config check doesn't allow this. The error I get is:
Fix your configuration: add @Module annotation on <Module class generated by ktorfit-koin>
Describe the solution you'd like
Optionally disable @Module annotation presence check (for generated code?). Or implement some plugin mechanism?
Describe alternatives you've considered Disabling koin config check.
Target Koin project Koin annotations, to be specific config check part.
I have resolved this (see latest commit in the repo above).
can you give ref of your commit?
can you give ref of your commit?
d6234843906423fcbf0ecd924f5de6564770e1d3
Check the part with markerName. Basically I manually generate an empty class for each ktorfit-koin module so that koin config check doesn't complain about missing @Module annotation on those.
Not sure if that is relevant to koin-annotations anymore. But could you explain please what's the purpose behind those generated empty classes (they end with Def from what I remember)?
You can give a try with Koin Annotations 2.0-RC1. The idea of "tag" is marking having a way to store an index (what would result from a definition), and then retrieve it with just a class lookup. This avoids parsing heavy data, class is easily accessible by classpath search.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.