@@ -17,6 +17,7 @@ class MokkeryGradlePluginFunctionalTest {
1717
1818 private val buildFile by lazy { testProjectDir.resolve(" build.gradle.kts" ) }
1919 private val settingsFile by lazy { testProjectDir.resolve(" settings.gradle.kts" ) }
20+ private val localPropertiesFile by lazy { testProjectDir.resolve(" local.properties" ) }
2021
2122 @Test
2223 fun `test minimum Kotlin version` () {
@@ -27,6 +28,10 @@ class MokkeryGradlePluginFunctionalTest {
2728 private fun test (kotlinVersion : String ) {
2829 settingsFile.writeText(settingsFileContent)
2930 buildFile.writeText(buildFileContent)
31+ File (" ../local.properties" )
32+ .takeIf { it.exists() }
33+ ?.copyTo(localPropertiesFile)
34+
3035 File (" ../test-mokkery/src" ).toPath()
3136 .copyToRecursively(
3237 testProjectDir
@@ -40,6 +45,7 @@ class MokkeryGradlePluginFunctionalTest {
4045 .withArguments(
4146 " -PkotlinVersion=${kotlinVersion} " ,
4247 " -PmokkeryVersion=${MokkeryConfig .VERSION } " ,
48+ " -PagpVersion=${BuildConfig .AGP_VERSION } " ,
4349 " -Porg.gradle.jvmargs=-Xmx1g" ,
4450 " -Pkotlin.daemon.jvmargs=-Xmx1g" ,
4551 " clean" ,
@@ -57,17 +63,20 @@ private val settingsFileContent = """
5763 pluginManagement {
5864 val kotlinVersion: String by settings
5965 val mokkeryVersion: String by settings
66+ val agpVersion: String by settings
6067 plugins {
6168 kotlin("multiplatform") version kotlinVersion
6269 id("org.jetbrains.kotlin.plugin.allopen") version kotlinVersion
6370 id("dev.mokkery") version mokkeryVersion
71+ id("com.android.kotlin.multiplatform.library") version agpVersion
6472 }
6573 repositories {
6674 mavenCentral {
6775 content {
6876 excludeGroup("dev.mokkery")
6977 }
7078 }
79+ google()
7180 maven {
7281 name = "testing"
7382 url = uri("${BuildConfig .TESTING_REPO_URL } ")
@@ -82,6 +91,7 @@ private val settingsFileContent = """
8291 excludeGroup("dev.mokkery")
8392 }
8493 }
94+ google()
8595 maven {
8696 name = "testing"
8797 url = uri("${BuildConfig .TESTING_REPO_URL } ")
@@ -94,6 +104,7 @@ private val settingsFileContent = """
94104private val buildFileContent = $$"""
95105 @file:OptIn(ExperimentalKotlinGradlePluginApi::class, ExperimentalWasmDsl::class)
96106
107+ import com.android.build.api.dsl.KotlinMultiplatformAndroidLibraryTarget
97108 import dev.mokkery.gradle.ApplicationRule
98109 import dev.mokkery.gradle.mokkery
99110 import dev.mokkery.options.AnnotationSelector.Companion.all
@@ -107,6 +118,7 @@ private val buildFileContent = $$"""
107118 kotlin("multiplatform")
108119 id("dev.mokkery")
109120 id("org.jetbrains.kotlin.plugin.allopen")
121+ id("com.android.kotlin.multiplatform.library")
110122 }
111123
112124 allOpen {
@@ -127,9 +139,22 @@ private val buildFileContent = $$"""
127139 group("wasm") {
128140 withWasmJs()
129141 }
142+ group("jvmShared") {
143+ withJvm()
144+ withCompilations { it.target is KotlinMultiplatformAndroidLibraryTarget }
145+ }
130146 }
131147 }
132148
149+ android {
150+ namespace = "dev.mokkery.test"
151+ compileSdk = 36
152+ minSdk = 21
153+ withHostTest { }
154+ withDeviceTestBuilder {
155+ sourceSetTreeName = "test"
156+ }
157+ }
133158 jvm()
134159 js(IR) { nodejs() }
135160 wasmJs { nodejs() }
0 commit comments