Hi. I'm trying to use IntelliJ IDEA on Windows to ...
# multiplatform
j
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
How's your nativeMain configured? Have you verified it works on other OS (mac, win)?
j
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
What's the value of os.name sys prop on wsl?
j
Linux
b
Then it's likely an ide issue. Your config looks ok and ij wsl support is still flakey at best.