John O'Reilly
11/15/2024, 4:24 PMMissing Definition type 'io.ktor.client.engine.HttpClientEngine'
despite having following (and similar for other platforms)....not certain this is correct approach?
@Module
actual class NativeModule {
@Single
fun httpClientEngine(): HttpClientEngine = Java.create()
}
The common code includes the following
@Module(includes = [CommonModule::class, NativeModule::class])
class AppModule
@Module
expect class NativeModule
John O'Reilly
11/15/2024, 4:25 PM@Module
@ComponentScan("com.surrus.common")
class CommonModule {
@Single
fun json() = Json { isLenient = true; ignoreUnknownKeys = true }
@Single
fun httpClient(httpClientEngine: HttpClientEngine, json : Json) = createHttpClient(httpClientEngine, json, true)
}
arnaud.giuliani
11/15/2024, 5:02 PMJohn O'Reilly
11/15/2024, 5:10 PMNativeModule
(though fixing it here and seem to still see same issue)....will take a look at generated codeJohn O'Reilly
11/15/2024, 5:11 PM@Module
expect class NativeModule {
fun httpClientEngine(): HttpClientEngine
}
and for example
@Module
actual class NativeModule {
@Single
actual fun httpClientEngine(): HttpClientEngine = Android.create()
}
arnaud.giuliani
11/15/2024, 5:15 PMarnaud.giuliani
11/15/2024, 5:21 PMJohn O'Reilly
11/15/2024, 5:22 PM@Single
also in expect class
@Module
expect class NativeModule {
@Single
fun httpClientEngine(): HttpClientEngine
}
but getting following now
Expected class 'expect class NativeModule : Any' does not have default constructor.
John O'Reilly
11/15/2024, 5:22 PMJohn O'Reilly
11/15/2024, 5:23 PMpublic val com_surrus_common_di_AppModule : Module get() = module {
includes(com.surrus.common.di.CommonModule().module,com.surrus.common.di.NativeModule().module)
}
public val com.surrus.common.di.AppModule.module : org.koin.core.module.Module get() = com_surrus_common_di_AppModule
John O'Reilly
11/15/2024, 5:24 PMJohn O'Reilly
11/15/2024, 5:31 PM@Module
expect class NativeModule() {
@Single
fun httpClientEngine(): HttpClientEngine
}
@Module
actual class NativeModule actual constructor() {
@Single
actual fun httpClientEngine(): HttpClientEngine = Android.create()
}
but now get
None of the following candidates is applicable:
val AppModule.module: Module
val CommonModule.module: Module
re. module
in following
includes(com.surrus.common.di.CommonModule().module,com.surrus.common.di.NativeModule().module)
John O'Reilly
11/15/2024, 5:39 PMJohn O'Reilly
11/15/2024, 5:41 PMJohn O'Reilly
11/15/2024, 5:41 PM2.0.0-Beta1
of koin annotations btwarnaud.giuliani
11/15/2024, 6:08 PMarnaud.giuliani
11/15/2024, 6:08 PMarnaud.giuliani
11/15/2024, 6:08 PMarnaud.giuliani
11/15/2024, 6:08 PMJohn O'Reilly
11/15/2024, 6:09 PMNativeModule
has it's own functions (not relying only on component scan etc)?arnaud.giuliani
11/15/2024, 6:10 PMarnaud.giuliani
11/15/2024, 6:10 PMJohn O'Reilly
11/15/2024, 6:10 PMJohn O'Reilly
11/15/2024, 6:11 PMarnaud.giuliani
11/15/2024, 6:11 PMJohn O'Reilly
11/15/2024, 6:11 PMarnaud.giuliani
11/15/2024, 6:21 PMarnaud.giuliani
11/15/2024, 6:22 PMJohn O'Reilly
11/15/2024, 6:23 PMJohn O'Reilly
11/16/2024, 11:20 AMJohn O'Reilly
11/16/2024, 11:20 AMNativeModule.module
John O'Reilly
11/16/2024, 11:38 AMDusan Stefanovic
11/17/2024, 3:59 PMarnaud.giuliani
11/18/2024, 8:04 AMarnaud.giuliani
11/18/2024, 2:14 PMarnaud.giuliani
11/18/2024, 3:52 PMarnaud.giuliani
11/18/2024, 3:53 PMarnaud.giuliani
11/18/2024, 3:53 PMarnaud.giuliani
11/18/2024, 5:53 PMJohn O'Reilly
11/18/2024, 6:08 PMrg.jetbrains.kotlin.backend.common.CompilationException: Back-end: Please report this problem <https://kotl.in/issue>
/Users/joreilly/dev/github/PeopleInSpace/common/build/generated/sqldelight/code/PeopleInSpaceDatabase/commonMain/com/surrus/peopleinspace/db/PeopleInSpaceQueries.kt:-1:-1
Details: Internal error in file lowering: java.lang.IllegalStateException: should not be called
John O'Reilly
11/18/2024, 6:08 PMJohn O'Reilly
11/18/2024, 6:09 PMJohn O'Reilly
11/18/2024, 6:13 PMAndroidSqliteDriver
etc needs to be wired up stillJohn O'Reilly
11/18/2024, 6:13 PMJohn O'Reilly
11/18/2024, 7:31 PMPeopleInSpaceDatabaseWrapper
(changes pushed to that branch) but getting following.
e: [ksp] --> Missing Definition type 'com.surrus.common.di.PeopleInSpaceDatabaseWrapper' for 'com.surrus.common.repository.PeopleInSpaceRepository'. Fix your configuration to define type 'PeopleInSpaceDatabaseWrapper'.
John O'Reilly
11/18/2024, 7:32 PMexpect class PeopleInSpaceDatabaseWrapper {
fun database() : PeopleInSpaceDatabase?
}
and then for example in androidMain
@Single
actual class PeopleInSpaceDatabaseWrapper(val context: Context) {
actual fun database(): PeopleInSpaceDatabase?
= PeopleInSpaceDatabase(AndroidSqliteDriver(PeopleInSpaceDatabase.Schema, context, "peopleinspace.db"))
}
arnaud.giuliani
11/19/2024, 8:28 AMJohn O'Reilly
11/19/2024, 8:29 AMarnaud.giuliani
11/19/2024, 8:35 AMarnaud.giuliani
11/19/2024, 11:17 AM@Provided
:arnaud.giuliani
11/19/2024, 11:18 AMarnaud.giuliani
11/19/2024, 11:18 AMarnaud.giuliani
11/19/2024, 11:20 AMarnaud.giuliani
11/19/2024, 11:20 AM@ComponentScan
can scan across modulesJohn O'Reilly
11/19/2024, 11:21 AMJohn O'Reilly
11/19/2024, 11:21 AMPeopleInSpaceDatabaseWrapper
is wired up etc if you think there might be better wayJohn O'Reilly
11/19/2024, 11:21 AMJohn O'Reilly
11/19/2024, 11:22 AMarnaud.giuliani
11/19/2024, 11:23 AMJohn O'Reilly
11/19/2024, 11:24 AM@Provided
something that will generally be needed in this case or just workaround for now?arnaud.giuliani
11/19/2024, 2:07 PMJohn O'Reilly
11/19/2024, 4:36 PM@Provided
(and also removed the unncessary @ComponentScan
s)....it's building now but getting following crash at runtime
11-19 16:35:33.747 15979 15979 E [Koin] : * Instance creation error : could not create instance for '[Singleton: 'com.surrus.common.repository.PeopleInSpaceRepository',binds:com.surrus.common.repository.PeopleInSpaceRepositoryInterface]': org.koin.core.error.NoDefinitionFoundException: No definition found for type 'com.surrus.common.di.PeopleInSpaceDatabaseWrapper'. Check your Modules configuration and add missing type and/or qualifier!
arnaud.giuliani
11/19/2024, 6:19 PMarnaud.giuliani
11/19/2024, 6:19 PMarnaud.giuliani
11/19/2024, 6:19 PMarnaud.giuliani
11/19/2024, 6:20 PMarnaud.giuliani
11/19/2024, 6:20 PMJohn O'Reilly
11/19/2024, 6:21 PMJohn O'Reilly
11/19/2024, 6:22 PMJohn O'Reilly
11/19/2024, 6:22 PMarnaud.giuliani
11/20/2024, 7:59 AMarnaud.giuliani
11/20/2024, 8:00 AMKibet Theophilus
11/22/2024, 5:24 AMJohn O'Reilly
11/22/2024, 8:01 AMarnaud.giuliani
11/22/2024, 8:18 AMJohn O'Reilly
11/22/2024, 8:21 AMarnaud.giuliani
11/22/2024, 10:00 AMJohn O'Reilly
11/22/2024, 1:05 PMpeopleInSpaceDatabase()
single? I thought there was issue if that was nullable....arnaud.giuliani
11/22/2024, 3:20 PMJohn O'Reilly
11/23/2024, 9:41 AM@Single
actual fun getPeopleInSpaceDatabaseWrapper(context: Context)
= PeopleInSpaceDatabaseWrapper(PeopleInSpaceDatabase(AndroidSqliteDriver(PeopleInSpaceDatabase.Schema, context, "peopleinspace.db")))
John O'Reilly
11/23/2024, 9:42 AM@Module
expect class NativeModule() {
@Single
fun getHttpClientEngine(): HttpClientEngine
@Single
fun getPeopleInSpaceDatabaseWrapper(): PeopleInSpaceDatabaseWrapper
}
arnaud.giuliani
11/25/2024, 8:08 AMJohn O'Reilly
11/25/2024, 8:06 PMarnaud.giuliani
11/26/2024, 10:43 AM