kosi-libs / MocKMP

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

Provide a way to apply MocKMP to commonMain as well #47

Closed dalewking closed 1 year ago

dalewking commented 1 year ago

I have a testSupport module in my project that generates code to support testing for both common code and for the Android app tests. The project is included as a test dependency in other modules.

The code for the testSupport module is in commonMain, not in commonTest. I want to create Mocks in this code, but the gradle plugin only supports applying it to the commonTest sourceSet

You should provide a configuration value that allows you to switch to applying it to commonMain instead of commonTest

SalomonBrys commented 1 year ago

Supported in 1.12.0.

https://github.com/kosi-libs/MocKMP#applying-to-main-source-sets

Thanks for the suggestion ;)

dalewking commented 1 year ago

Only problem is that you released that in 1.12.0 which requires Kotlin 1.8 which we have not upgraded to yet.

dalewking commented 1 year ago

But was not difficult to force KSP version

dalewking commented 1 year ago

Take that back, does not work for force Kotlin 1.7 version with 1.12.0

dalewking commented 1 year ago

Thinking about it some more there are going to be cases where we may need to apply to platform specific source sets as well. Coupled with the ksp versioning issue I'm thinking the gradle plugin may be a bad idea and I will probably try to just do it in the gradle files, much like Mockative does