fun projectNeedsPlatform()

in runtime/build.gradle.kts [18:28]


fun projectNeedsPlatform(project: Project, platform: String ): Boolean {
    val files = project.projectDir.listFiles()
    val hasPosix = files.any { it.name == "posix" }
    val hasDarwin = files.any { it.name == "darwin" }

    if (hasPosix && platform == "darwin") return false
    if (hasDarwin && platform == "posix") return false
    if (!hasPosix && !hasDarwin && platform == "darwin") return false
    // add implicit JVM target if it has a common module
    return files.any{ it.name == platform || (it.name == "common" && platform == "jvm")}
}