如何将 testOptions.unitTests.all 转换为 gradle Kotlin dsl
How to convert testOptions.unitTests.all to gradle Kotlin dsl
如何将此代码从 Groovy 转换为 Gradle 中的 Kotlin DSL?
testOptions.unitTests.all {
testLogging {
exceptionFormat = "full"
events "passed", "failed", "standardError"
showCauses true
showExceptions true
}
}
使用这个:
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
testOptions.unitTests.apply {
all(KotlinClosure1<Test, Test>({
apply {
testLogging.exceptionFormat = TestExceptionFormat.FULL
testLogging.events = setOf(
TestLogEvent.PASSED,
TestLogEvent.FAILED,
TestLogEvent.STANDARD_ERROR
)
testLogging.showCauses = true
testLogging.showExceptions = true
}
}, this))
}
如何将此代码从 Groovy 转换为 Gradle 中的 Kotlin DSL?
testOptions.unitTests.all {
testLogging {
exceptionFormat = "full"
events "passed", "failed", "standardError"
showCauses true
showExceptions true
}
}
使用这个:
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
testOptions.unitTests.apply {
all(KotlinClosure1<Test, Test>({
apply {
testLogging.exceptionFormat = TestExceptionFormat.FULL
testLogging.events = setOf(
TestLogEvent.PASSED,
TestLogEvent.FAILED,
TestLogEvent.STANDARD_ERROR
)
testLogging.showCauses = true
testLogging.showExceptions = true
}
}, this))
}