kosi-libs / MocKMP

A mocking processor for Kotlin Multiplatform
https://kosi-libs.org/mockmp
MIT License
183 stars 12 forks source link

MocKMP does not work with new androidSourceSetLayout #53

Closed HylkeB closed 1 year ago

HylkeB commented 1 year ago

When using the latest version of MocKMP (version 1.12.0) combined with kotlin version 1.8.0, I got the following warning:

w: Multiplatform/Android-V1-SourceSetLayout: Multiplatform/Android-V1-SourceSetLayout is deprecated. Use Multiplatform/Android-V2-SourceSetLayout instead. 
To enable Multiplatform/Android-V2-SourceSetLayout: put the following in your gradle.properties: 
kotlin.mpp.androidSourceSetLayoutVersion=2

After changing that, and replacing androidTest for androidUnitTest in my gradle and folder names, MocKMP no longer properly generates the mocks. (probably in the wrong v1 sourceset location or something like that).

dan-nichols commented 1 year ago

Not sure if you've solved this already, but I think I had the same issue and have found a workaround for it.

kotlin {
    // ...
    sourceSets {
        // ...
        val commonTest by getting {
            dependencies {
                // ...
            }
            kotlin.srcDir("${project.buildDir}/generated/ksp/android/androidUnitTestDebug/kotlin")
        }
    }
}

It is very similar to the workaround described here, and mimics what the plugin does, just with the new source layout.

Hope this helps!

SalomonBrys commented 1 year ago

Fix released in v1.14.0.