Hi. I'm trying to use IntelliJ IDEA on Windows to open a multiplatform project in WSL2, but it seems to only recognize the JVM sourceset. Is this a known issue?
b
Big Chungus
06/22/2023, 5:17 PM
How's your nativeMain configured? Have you verified it works on other OS (mac, win)?
j
Jason5lee
06/23/2023, 11:13 AM
It is a project created using IntelliJ IDEA. Here is the
build.gradle.kts
Copy code
plugins {
kotlin("multiplatform") version "1.8.21"
}
group = "me.jason5lee"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
kotlin {
jvm {
jvmToolchain(17)
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
val hostOs = System.getProperty("os.name")
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting
val jvmTest by getting
val nativeMain by getting
val nativeTest by getting
}
}
I've tested that it works on Windows.
b
Big Chungus
06/23/2023, 11:19 AM
What's the value of os.name sys prop on wsl?
j
Jason5lee
06/23/2023, 11:22 AM
Linux
b
Big Chungus
06/23/2023, 11:22 AM
Then it's likely an ide issue. Your config looks ok and ij wsl support is still flakey at best.