-
Notifications
You must be signed in to change notification settings - Fork 22
Description
I'm trying to get annotations with ksp working in an Android/iOS multiplatform project using the "Framework"-style Xcode integration.
I assume because proper common codegen support is lacking from ksp, this example uses the trick of adding the android generated code to the common source set, to make the generated symbols accessible from common code (in this case, the .module extension property on @Module annotated classes):
hello-kmp/shared/build.gradle.kts
Line 35 in 6644448
| kotlin.srcDir("build/generated/ksp/android/androidDebug/kotlin") |
I'm using this setup in my project with the only difference being that I have only the iosArm64 and iosX64 targets for iOS (which I figure doesn't make a difference here).
This works fine for Android, but in my case leads to an overload resolution ambiguity when gradle attempts to build the framework, since both the compiler/ksp generated code for the specific iOS source set as well as the explicitly added symbols for Android are visible:
e: /Users/julian/Documents/SoftwareDevelopment/Projects/Flow/flow-shared/src/commonMain/kotlin/de/julianostarek/flow/FlowModule.kt: (27, 30): Overload resolution ambiguity:
public val FlowModule.module: Module defined in org.koin.ksp.generated in file FlowModuleGende$julianostarek$flow.kt
public val FlowModule.module: Module defined in org.koin.ksp.generated in file FlowModuleGende$julianostarek$flow.kt
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ':flow-shared:compileKotlinIosArm64'.
Compilation finished with errors
Mapping back to this example (annotations branch), the above error would refer to the following line:
| fun appModule() = listOf(AppModule().module) |
Do you see a way to resolve this that does not involve having to do Koin initialization separately in androidMain, iosMain etc. source sets?