I’m having issues using optics’ ksp plugin within ...
# arrow
d
I’m having issues using optics’ ksp plugin within a multiplatform project with iOS targets. I get conflicting declarations from the generated code. (error in thread). I noticed that the same code is generated and put in all
build/generated/ksp/metadata/commonMain/kotlin
and
build/generated/ksp/ios*/ios*Main/kotlin
. Hence I get errors for each generated declaration for each ios target. Is it expected to have generated code for each target and not just in the common directory? The code I have annotated with
@optics
resides within the
shared
folder. I’ve also created a minimum reproduce project (link in thread).
Error:
Copy code
e: file:.../TestKSP/shared/build/generated/ksp/metadata/commonMain/kotlin/com/exampleapp/testksp/CommonSealed.A__Optics.kt:25:85 Conflicting declarations: public val CommonSealed.A.Companion.value
e: file:.../TestKSP/shared/build/generated/ksp/iosArm64/iosArm64Main/kotlin/com/exampleapp/testksp/CommonSealed.A__Optics.kt:25:85 Conflicting declarations: public val CommonSealed.A.Companion.value
...
or perhaps this is because I have configured ksp for iOS targets as well?
Copy code
add("kspIosX64", "io.arrow-kt:arrow-optics-ksp-plugin:1.2.1")
add("kspIosArm64", "io.arrow-kt:arrow-optics-ksp-plugin:1.2.1")
add("kspIosSimulatorArm64", "io.arrow-kt:arrow-optics-ksp-plugin:1.2.1")
however if I don’t, I won’t be able to use optics for ios specific code
perhaps it’s a ksp limitation?
a
you might try to do it only for commonMain, but I'm not really an expert on KSP + KMP 😕