is there any anvil-like effort in koin annotations...
# koin
a
is there any anvil-like effort in koin annotations to support providing modules automatically to the koin graph in an app module? or is the current approach to manually wire up all modules in the app module ?
👍 1
p
I think that's what the arg KOIN_DEFAULT_MODULE is for
I will automatically put the definitions there, if you don't explicitly define a module for the definition
Oh sorry 😔 I just checked in the docs, the generated defaultModule still requires manual addition 😔
s
p
It seems that is to put the definitions declared inside a package in a specific module. But I think Andrew is asking about not having to tell koin what modules to load. Why not add all them, perhaps setting an annotation flag to indicate @Module(addToKoin = true, is lazy = true)
a
right what im asking for is. a mechanism not to have to write :
Copy code
startKoin {
  modules(
   module1,
   module2,
   ...
   module1000,
 )
}
manually
in our project with 450+ gradle modules, we then would have to add potentially few hundred modules into app module, or demo apps, etc which is not great. anvil + kotlin inject anvil solve this well, and was wondering if someone or koin annotations provides this functionality
p
450+ modules ? wow me thinking I worked in really big apps. I think we could think of some argument arg KOIN_AUTO_ADD = true but would only work for annotations
a
Yeah that’s fine if it’s just koin annotations. I’m sure other projects would benefit. Using the gradle dependency graph to add dependencies works well even in smaller apps if you have multiple app projects or demo apps
I’m happy to file an issue if there already isn’t one
a
we could explore module discovery. For now, we still need to generate a module entry point for Koin. Some works with Kotlin compiler help us go beyond too
a
For now, we still need to generate a module entry point for Koin
yeah if you are aware of the generated modules or had a way to discover them in the root project, then youd just need to generate the DSL extension to provide the list of modules to apply to koin.