Skip to content

Commit

Permalink
room di
Browse files Browse the repository at this point in the history
  • Loading branch information
kotlitecture committed Jul 11, 2024
1 parent a473203 commit de601f2
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ object Rules {
const val BackendDir = "backend"

// kotlin
const val DIKt = "*/DI*.kt"
const val CommonAppSrcDir = "app/src"
const val SharedDesignSrcDir = "shared/design/src"
const val CommonAppMainDir = "${CommonAppSrcDir}/commonMain"
const val AppIconsProviderKt = "${SharedDesignSrcDir}/commonMain/kotlin/shared/design/icon/AppIconsProvider.kt"
const val AppModuleKt = "${CommonAppMainDir}/kotlin/kotli/app/di/presentation/AppModule.kt"
const val AppDIKt = "${CommonAppMainDir}/kotlin/kotli/app/di/DI.kt"
const val AppWebPackConfigDir = "app/webpack.config.d"
const val AppSqlDelightConfigJs = "${AppWebPackConfigDir}/sqljs-config.js"
const val AppPresentationDir = "${CommonAppMainDir}/kotlin/kotli/app/presentation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object FacadeAnalyticsProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("AnalyticsSource")
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ object BasicCacheProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("CacheSource")
)
state.onApplyRules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ object FacadeConfigProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("ConfigSource")
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ object RoomProcessor : BaseFeatureProcessor() {
"app/schemas",
RemoveFile()
)
state.onApplyRules(
Rules.DIKt,
RemoveMarkedLine("RoomSource")
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object SqlDelightProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("SqlDelightSource")
)
state.onApplyRules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object KtorHttpProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("HttpSource")
)
state.onApplyRules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object CommonKeyValueProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("KeyValueSource")
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object CashAppPagingProcessor : BaseFeatureProcessor() {
RemoveFile()
)
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("PagingSource")
)
state.onApplyRules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object NavigationBarProcessor : BaseFeatureProcessor() {

override fun doRemove(state: TemplateState) {
state.onApplyRules(
Rules.AppDIKt,
Rules.DIKt,
RemoveMarkedLine("navigationBarModule")
)
state.onApplyRules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class MultiplatformComposeTemplateProcessorTest {
}
}

@RepeatedTest(1)
@RepeatedTest(3)
fun `compose template with random features`() {
runBlocking {
val processors = processor.getFeatureProviders()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package kotli.app.di

import kotli.app.di.data.roomSourceModule
import org.koin.core.KoinApplication

actual fun configure(app: KoinApplication) {
app.modules(
roomSourceModule
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kotli.app.di.data

import kotli.app.data.source.database.room.AppRoomSource
import org.koin.dsl.module

val roomSourceModule = module {
single { AppRoomSource() }
}
4 changes: 4 additions & 0 deletions template/app/src/iosMain/kotlin/kotli/app/di/DI.ios.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package kotli.app.di

import kotli.app.di.data.roomSourceModule
import org.koin.core.KoinApplication

actual fun configure(app: KoinApplication) {
app.modules(
roomSourceModule
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kotli.app.di.data

import kotli.app.data.source.database.room.AppRoomSource
import org.koin.dsl.module

val roomSourceModule = module {
single { AppRoomSource() }
}
4 changes: 4 additions & 0 deletions template/app/src/jvmMain/kotlin/kotli/app/di/DI.jvm.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package kotli.app.di

import kotli.app.di.data.roomSourceModule
import org.koin.core.KoinApplication

actual fun configure(app: KoinApplication) {
app.modules(
roomSourceModule
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kotli.app.di.data

import kotli.app.data.source.database.room.AppRoomSource
import org.koin.dsl.module

val roomSourceModule = module {
single { AppRoomSource() }
}

0 comments on commit de601f2

Please sign in to comment.