kosi-libs / MocKMP

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

After adding mocKMP am forced to upgrade to jvm 17 #64

Open kmadsen opened 1 year ago

kmadsen commented 1 year ago

I'm not certain if this is a real issue for mocKMP but am seeing if some of the devs know if they added something that would cause this to force upgrade.

Essentially we added mocKMP to a kotlin multiplatform project in hopes to have mocking in the project. But we are building a SDK and are concerned that if we include it would force developers using our SDK to upgrade to jvm17 as well.

Can someone here provide some insight for what is causing this? Below is a shrunken version of a build.gradle.kts that shows the changes we are forced to make when adding the mockmp plugin.

plugins {
    kotlin("multiplatform")
    id("com.android.library")
    id("kotlin-parcelize")
    id("com.rickclephas.kmp.nativecoroutines")
    id("com.google.devtools.ksp")
+   id("org.kodein.mock.mockmp") version "1.14.0"
}
kotlin {
    android {
        compilations.all {
            kotlinOptions {
-                jvmTarget = "1.8"
+                jvmTarget = "17"
            }
        }
    }
android {
    buildToolsVersion = "33.0.2"
    compileSdk = 33
    defaultConfig {
        minSdk = 21
    }
+    compileOptions {
+        sourceCompatibility = JavaVersion.VERSION_17
+        targetCompatibility = JavaVersion.VERSION_17
+    }
}

+ mockmp {
+    usesHelper = true
+ }
SalomonBrys commented 9 months ago

That is very weird as MocKMP is indeed compiled with JDK 17 but targets JDK 1.8.

% javap -verbose org.kodein.mock.gradle.MocKMPGradlePlugin | grep major
  major version: 52

% javap -verbose org.kodein.mock.tests.TestsWithMocks | grep major 
  major version: 52

% javap -verbose org.kodein.mock.Mocker | grep major
  major version: 52

you should not have to target 17. Whats is the error ?