Gradle, tests: introduce kotlin.tests.individualTaskReports
This property required for getting individual junit.xml files that is currently used in test run assertions.
This commit is contained in:
+1
@@ -0,0 +1 @@
|
|||||||
|
kotlin.tests.individualTaskReports=true
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
kotlin.tests.individualTaskReports=true
|
||||||
+9
@@ -96,6 +96,15 @@ internal class PropertiesProvider(private val project: Project) {
|
|||||||
val parallelTasksInProject: Boolean?
|
val parallelTasksInProject: Boolean?
|
||||||
get() = booleanProperty("kotlin.parallel.tasks.in.project")
|
get() = booleanProperty("kotlin.parallel.tasks.in.project")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables individual test task reporting for aggregated test tasks.
|
||||||
|
*
|
||||||
|
* By default individual test tasks will not fail build if this task will be executed,
|
||||||
|
* also individual html and xml reports will replaced by one consolidated html report.
|
||||||
|
*/
|
||||||
|
val individualTaskReports: Boolean?
|
||||||
|
get() = booleanProperty("kotlin.tests.individualTaskReports")
|
||||||
|
|
||||||
private fun booleanProperty(propName: String): Boolean? =
|
private fun booleanProperty(propName: String): Boolean? =
|
||||||
property(propName)?.toBoolean()
|
property(propName)?.toBoolean()
|
||||||
|
|
||||||
|
|||||||
+8
-3
@@ -11,6 +11,7 @@ import org.gradle.api.tasks.Input
|
|||||||
import org.gradle.api.tasks.Internal
|
import org.gradle.api.tasks.Internal
|
||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
import org.gradle.api.tasks.testing.*
|
import org.gradle.api.tasks.testing.*
|
||||||
|
import org.jetbrains.kotlin.gradle.plugin.PropertiesProvider
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
@@ -19,7 +20,8 @@ import java.net.URI
|
|||||||
*
|
*
|
||||||
* Individual test tasks will not fail build if this task will be executed,
|
* Individual test tasks will not fail build if this task will be executed,
|
||||||
* also individual html and xml reports will replaced by one consolidated html report.
|
* also individual html and xml reports will replaced by one consolidated html report.
|
||||||
* This behavior can be disabled by setting [overrideReporting] to `false`.
|
* This behavior can be disabled by setting `kotlin.tests.individualTaskReports` property
|
||||||
|
* to true.
|
||||||
*
|
*
|
||||||
* Aggregate test reports may form hierarchy, for example:
|
* Aggregate test reports may form hierarchy, for example:
|
||||||
* - allTest // aggregates all tests
|
* - allTest // aggregates all tests
|
||||||
@@ -45,8 +47,10 @@ open class KotlinTestReport : TestReport() {
|
|||||||
@Internal
|
@Internal
|
||||||
val children = mutableListOf<KotlinTestReport>()
|
val children = mutableListOf<KotlinTestReport>()
|
||||||
|
|
||||||
@Input
|
private val projectProperties = PropertiesProvider(project)
|
||||||
var overrideReporting: Boolean = true
|
|
||||||
|
val overrideReporting: Boolean
|
||||||
|
@Input get() = projectProperties.individualTaskReports == null
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
var checkFailedTests: Boolean = false
|
var checkFailedTests: Boolean = false
|
||||||
@@ -139,6 +143,7 @@ open class KotlinTestReport : TestReport() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun maybeOverrideReporting(graph: TaskExecutionGraph) {
|
fun maybeOverrideReporting(graph: TaskExecutionGraph) {
|
||||||
|
if (!overrideReporting) return
|
||||||
if (!graph.hasTask(this)) return
|
if (!graph.hasTask(this)) return
|
||||||
|
|
||||||
// only topmost aggregate should override reporting
|
// only topmost aggregate should override reporting
|
||||||
|
|||||||
Reference in New Issue
Block a user