From c7c52b90beef8c5c39441dcadade131144261db7 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 28 Oct 2018 19:36:23 +0100 Subject: [PATCH] Replace AGP-internal interface to achieve better compatibility --- .../gradle/plugins/junit5/tasks/Jacoco.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/tasks/Jacoco.kt b/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/tasks/Jacoco.kt index 6db4bb8a..e4f57024 100644 --- a/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/tasks/Jacoco.kt +++ b/android-junit5/src/main/kotlin/de/mannodermaus/gradle/plugins/junit5/tasks/Jacoco.kt @@ -1,7 +1,6 @@ package de.mannodermaus.gradle.plugins.junit5.tasks import com.android.build.gradle.api.BaseVariant -import com.android.build.gradle.internal.scope.TaskConfigAction import de.mannodermaus.gradle.plugins.junit5.internal.android import de.mannodermaus.gradle.plugins.junit5.internal.extensionByName import de.mannodermaus.gradle.plugins.junit5.internal.junit5Info @@ -34,7 +33,9 @@ open class AndroidJUnit5JacocoReport : JacocoReport() { testTask: Test, directoryProviders: Collection): AndroidJUnit5JacocoReport { val configAction = ConfigAction(project, variant, testTask, directoryProviders) - return project.tasks.create(configAction.name, configAction.type, configAction) + return project.tasks.create(configAction.name, configAction.type) { + configAction.execute(it) + } } } @@ -46,15 +47,15 @@ open class AndroidJUnit5JacocoReport : JacocoReport() { val variant: BaseVariant, val testTask: Test, private val directoryProviders: Collection - ) : TaskConfigAction { + ) { private val scope = variant.variantData.scope - override fun getName(): String = scope.getTaskName(TASK_NAME_DEFAULT) + val name: String = scope.getTaskName(TASK_NAME_DEFAULT) - override fun getType() = AndroidJUnit5JacocoReport::class.java + val type = AndroidJUnit5JacocoReport::class.java - override fun execute(reportTask: AndroidJUnit5JacocoReport) { + fun execute(reportTask: AndroidJUnit5JacocoReport) { // Project-level configuration reportTask.dependsOn(testTask) reportTask.group = GROUP_REPORTING