io.github.sergkhram.AresExecPlugin.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ares-exec-plugin Show documentation
Show all versions of ares-exec-plugin Show documentation
Android report synchro plugin + execution
package io.github.sergkhram
import com.malinskiy.marathon.MarathonPlugin
import com.malinskiy.marathon.MarathonRunTask
import io.github.sergkhram.configuration.ConfigurationExtension
import io.github.sergkhram.configuration.ExecuteBy
import io.github.sergkhram.tasks.ExecutionWReportGenTask
import io.github.sergkhram.tasks.ExecutionWReportTask
import io.github.sergkhram.tasks.enableAllureForMarathon
import io.github.sergkhram.tasks.setScreenRecordTypeFromMarathon
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
class AresExecPlugin : Plugin {
override fun apply(project: Project) {
project.plugins.apply(AresPlugin::class)
project.plugins.apply(MarathonPlugin::class)
project.afterEvaluate {
val aresExtension: ConfigurationExtension = project.extensions.get("ares") as ConfigurationExtension
val executeBy = getPropertyExecuteBy(aresExtension)
executeBy?.let {
when(it) {
ExecuteBy.MARATHON -> {
val buildType = System.getProperty("buildType")?.toString() ?: aresExtension.marathonBlock?.buildType ?: "debug"
val marathonTaskName = "marathon${buildType.capitalize()}AndroidTest"
val marathonTask = project.tasks.get(marathonTaskName) as MarathonRunTask
marathonTask.enableAllureForMarathon()
aresExtension.setScreenRecordTypeFromMarathon(marathonTask)
marathonTask.marathonExtension.get().ignoreFailures = System.getProperty("marathonIgnoreFailures")?.toBoolean()
?: true //if you want to use clean marathon tasks - needed to set -DmarathonIgnoreFailures=false when execute the command
val runTestsWReportSyncTask = project.tasks.create("runTestsWReportSync").dependsOn(marathonTaskName)
runTestsWReportSyncTask.mustRunAfter(marathonTaskName)
val runTestsWReportGenTask = project.tasks.create("runTestsWReportGen").dependsOn(marathonTaskName)
runTestsWReportGenTask.mustRunAfter(marathonTaskName)
}
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy