How to configure Dokka for kotlin-multiplatform

Dokka does not yet really work with new MPP but I figured out a solution that works for me:

dokka {
    impliedPlatforms = ["Common"] // This will force platform tags for all non-common sources e.g. "JVM"
    kotlinTasks {
        // dokka fails to retrieve sources from MPP-tasks so they must be set empty to avoid exception
        // use sourceRoot instead (see below)
        []
    }
    sourceRoot {
        // assuming there is only a single source dir...
        path = kotlin.sourceSets.commonMain.kotlin.srcDirs[0]
        platforms = ["Common"]
    }
    sourceRoot {
        // assuming there is only a single source dir...
        path = kotlin.sourceSets.jvmMain.kotlin.srcDirs[0]
        platforms = ["JVM"]
    }
}

Good luck!