[Koin annotations 2.0.0-Beta1, kotlin 2.0.20] I am...
# koin
d
[Koin annotations 2.0.0-Beta1, kotlin 2.0.20] I am trying to configure expect/actual module like in this example, but it doesn’t work:
Copy code
// commonMain
@Module
expect class PlatformModule()

// android/iOS
@Module
@ComponentScan("com.myapp.app")
actual class PlatformModule actual constructor()
or
Copy code
// commonMain
@Module
expect class PlatformModule

// android/iOS
@Module
@ComponentScan("com.myapp.app")
actual class PlatformModule
But I get error that
PlatformModule().module
is not found/generated The gradle setup is same as the one in sample above, just Kotlin and Koin version are different Can anyone help? 🙂
1
I can see that the PlatformModule().module getter is generated in ksp/android/androidDebug/kotlin but somehow it can’t be referenced from ksp/metadata/commonMain/kotlin where it should be included in the “parent” Module….
Screenshot 2024-10-25 at 12.04.52.png
a
did you update all the versions with KSP around?
d
yeah, I did… if you want I can push the changes to some branch so you can take a look? this is now the original example just updated to annotations 2.0.0-Beta1
This is libs.versions.toml, and in build.gradle.kts I just added
Copy code
alias(libs.plugins.kotlinComposeCompiler)
a
is the generation working on android or iOS? You need to explicilty setup expect module in common and actual module in native part
from common side you won't see anything, as the compilation doesn't allow that
d
I am trying to build the android first, the example is as it was, completely unchanged, I am just trying to make it work with annotations 2.0.0-Beta1 and kotlin 2.0.20
I guess because of Kotlin update to 2.0 I had to add explicit empty constructor to the expect class, but the rest is pretty much the same
Copy code
@Module
expect class NativeModule() // it was expect class NativeModule
a
You just updated Kotlin, Compose & Koin?
You need to upgrade all libs around
d
I think I did all of that… is it ok to push it to some branch for a review?
a
yeah push it. Will try to review it next week 👍
I'm unqueuing stuff for Koin
d
ok, great, thanks a lot! btw where to push it, I don’t have a permission to contribute to https://github.com/InsertKoinIO/KMP-App-Template/ should I fork the repo and push it there ?
b
@arnaud.giuliani
Copy code
kotlin = "2.0.20"
koin = "4.0.0"
koin-compose = "4.0.0"
koin-annotations = "2.0.0-Beta1"
ksp = "2.0.20-1.0.25"
This combination throws that error as well
d
@arnaud.giuliani Any news on this?
a
still need time to look at it
👍 2
can you downgrade to kotlin 2.0.20?
d
I tried both, 2.0.20 and 2.0.21, as well as other versions I could find and it was always the same issue… if you think it is different I can downgrade?
a
yeah KSP is tied to 2.0.20 ... then perhaps an issue there. I'm looking today
d
ok, thanks, I ll downgrade it…
👍 1
a
let me know yes
d
it’s done, you can take a look when you like
👍 1
a
Found the issue, and now proposes real expect/actual generation (not counting anymore on source shadowing) - https://github.com/InsertKoinIO/koin-annotations/pull/189/files
I send updates on your PR