Giorgi
04/04/2023, 3:00 PM_expect fun_ readFrom(input: List<String>): List<String>
In JVM I am using their API, but on other targets I use C API, which means 2 platforms (macos64 and linux64) have same code written in them.
how can I prevent code duplication in case only 1 platform has different code and all others have same implementation?ephemient
04/04/2023, 3:42 PMnativeMain
https://kotlinlang.org/docs/whatsnew1820.html#new-approach-to-source-set-hierarchy
or create it yourself https://kotlinlang.org/docs/multiplatform-hierarchy.html#manual-configurationGiorgi
04/04/2023, 4:02 PMephemient
04/04/2023, 4:09 PMkotlin {
sourceSets {
val commonMain by getting
val commonTest by getting
val nativeMain by creating {
dependsOn(commonMain)
}
val nativeTest by creating {
dependsOn(commonTest)
dependsOn(nativeMain)
}
targets.withType<KotlinNativeTargetWithHostTests> {
val targetMain = getByName("${name}Main") {
dependsOn(nativeMain)
}
getByName("${name}Test") {
dependsOn(nativeTest)
}
}
}
}
should be pretty complete, as long as you're not targeting ios