MocKMP icon indicating copy to clipboard operation
MocKMP copied to clipboard

After adding mocKMP am forced to upgrade to jvm 17

Open kmadsen opened this issue 1 year ago • 1 comments

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
+ }

kmadsen avatar Aug 08 '23 21:08 kmadsen

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 ?

SalomonBrys avatar Nov 21 '23 16:11 SalomonBrys