Kotlin Kodein Module's generator
We where Dagger users, for a couple of reasons, we decided to migrate to Kodein as our DI, but manually migrating and creating all injection binds for a big project was a total no-go. To make our lifes easier we created Morphine, it does code generation of classes and constructors annotated with javax.inject
annotations, its a Kodein companion for a Dagger-like experience.
dependencies {
implementation("io.vithor.libs:morphine-api:$morphineVersion")
// There are 2 version of the codegen, one for each Kodein counterpart
kapt("io.vithor.libs:morphine-generic-codegen:$morphineVersion")
// or
kapt("io.vithor.libs:morphine-erased-codegen:$morphineVersion")
}
kapt {
arguments {
arg("MAIN_PACKAGE", "your.module.package.sample")
}
}
import your.module.package.sample.allModules // Your sample module package defined earlier
// in each module's "MAIN_PACKAGE"
import org.kodein.di.Kodein
val sampleModule = Kodein.Module("My Sample Module") {
import(allModules)
}