https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
j

jasharp2000

09/06/2023, 7:55 PM
I’m looking for help with setting up unit tests against my
common
source code. I’m aware of three libraries built for this: • mockativemockMPMokkery When I add build dependencies for any of the three, I see the same error:
Copy code
The task 'commonizeNativeDistribution' (org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionCommonizerTask) is not a subclass of the given type (org.jetbrains.kotlin.gradle.targets.native.internal.NativeDistributionCommonizerTask).
	at org.gradle.api.internal.tasks.DefaultTaskCollection.createWrongTypeException(DefaultTaskCollection.java:107)
…
Given that I see it for all three, and others have not reported an identical error, I suspect this is not solely an issue with the libraries themselves. Can anyone point me in the right direction here? Posting key elements of build.gradle below in thread.
Copy code
plugins {
    kotlin("multiplatform") version 
"1.9.10"
    id("com.google.devtools.ksp") version "1.9.10-1.0.13"
  ...
}

...

kotlin {
    jvm {
        jvmToolchain(11)

        withJava()
    }

    sourceSets {
       ...
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
                implementation("io.mockative:mockative:2.0.1")
                ...
            }
        }
       ...
...

dependencies {
    configurations
        .filter { it.name.startsWith("ksp") && it.name.contains("Test") }
        .forEach {
            add(it.name, "io.mockative:mockative-processor:2.0.1")
        }
}
10 Views