From fc2eb26a1b444f2d81120d567bf8baf763965ccd Mon Sep 17 00:00:00 2001 From: "Sergey C." <119192+technoir42@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:17:44 +0100 Subject: [PATCH] Add support for isolated projects (#75) --- .../main/kotlin/com/malinskiy/marathon/MarathonPlugin.kt | 9 +++------ sample/gradle.properties | 1 + 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/marathon-gradle-plugin/src/main/kotlin/com/malinskiy/marathon/MarathonPlugin.kt b/marathon-gradle-plugin/src/main/kotlin/com/malinskiy/marathon/MarathonPlugin.kt index d23af513c..b099989a6 100644 --- a/marathon-gradle-plugin/src/main/kotlin/com/malinskiy/marathon/MarathonPlugin.kt +++ b/marathon-gradle-plugin/src/main/kotlin/com/malinskiy/marathon/MarathonPlugin.kt @@ -13,7 +13,6 @@ import org.gradle.api.Project import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.tasks.TaskProvider import org.gradle.kotlin.dsl.create -import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.registerIfAbsent @@ -52,13 +51,12 @@ class MarathonPlugin : Plugin { description = "Runs all the instrumentation test variations on all the connected devices" } - val marathonWorkerTask = rootProject.tasks.named(WORKER_TASK_NAME) val androidComponents = extensions.getByType(AndroidComponentsExtension::class.java) androidComponents.onVariants { variant -> variant.components .filter { it is GeneratesTestApk } .forEach { component -> - val testTask = registerTestTask(variant, component, marathonWorkerTask) + val testTask = registerTestTask(variant, component) marathonTask.configure { dependsOn(testTask) } } } @@ -66,8 +64,7 @@ class MarathonPlugin : Plugin { private fun Project.registerTestTask( variant: Variant, - testComponent: Component, - marathonWorkerTask: TaskProvider + testComponent: Component ): TaskProvider = tasks.register(variant.computeTaskName(TASK_PREFIX, "androidTest")) { group = JavaBasePlugin.VERIFICATION_GROUP @@ -83,7 +80,7 @@ class MarathonPlugin : Plugin { is TestVariant -> testedApkDir.set(variant.testedApks) } - finalizedBy(marathonWorkerTask) + finalizedBy("${Project.PATH_SEPARATOR}$WORKER_TASK_NAME") } companion object { diff --git a/sample/gradle.properties b/sample/gradle.properties index 5642b96f7..b12e9c48e 100644 --- a/sample/gradle.properties +++ b/sample/gradle.properties @@ -2,6 +2,7 @@ org.gradle.caching=true org.gradle.configuration-cache=true org.gradle.jvmargs=-Xmx8g -XX:+UseParallelGC org.gradle.parallel=true +org.gradle.unsafe.isolated-projects=true kotlin.daemon.jvmargs=-Xmx1g -XX:+UseParallelGC android.useAndroidX=true