[Gradle, MPP] Make init script for tests compatible w/ conf cache

Avoid using `beforeTask` API and switch to ones that are
compatible with Gradle configuration cache.
This commit is contained in:
Ivan Gavrilovic
2021-03-30 11:34:01 +01:00
committed by Alexander Likhachev
parent df77cd303f
commit 4e5f6492d9
@@ -1,18 +1,20 @@
gradle.taskGraph.beforeTask { task ->
def taskSuperClass = task.class
while (taskSuperClass != Object.class) {
if (taskSuperClass.canonicalName == "org.jetbrains.kotlin.gradle.tasks.KotlinTest") {
try {
KotlinMppTestLogger.logTestReportLocation(task.reports?.html?.entryPoint?.path)
KotlinMppTestLogger.configureTestEventLogging(task)
task.testLogging.showStandardStreams = false
gradle.taskGraph.whenReady { taskGraph ->
taskGraph.allTasks.each { task ->
def taskSuperClass = task.class
while (taskSuperClass != Object.class) {
if (taskSuperClass.canonicalName == "org.jetbrains.kotlin.gradle.tasks.KotlinTest") {
try {
KotlinMppTestLogger.logTestReportLocation(task.reports?.html?.entryPoint?.path)
KotlinMppTestLogger.configureTestEventLogging(task)
task.testLogging.showStandardStreams = false
}
catch (all) {
logger.error("", all)
}
return
} else {
taskSuperClass = taskSuperClass.superclass
}
catch (all) {
logger.error("", all)
}
return
} else {
taskSuperClass = taskSuperClass.superclass
}
}
}