Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotations: Overload resolution ambiguity #1

Open
jlnstrk opened this issue Jun 11, 2022 · 1 comment
Open

Annotations: Overload resolution ambiguity #1

jlnstrk opened this issue Jun 11, 2022 · 1 comment

Comments

@jlnstrk
Copy link

jlnstrk commented Jun 11, 2022

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):

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?

@flaringapp
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants