diff --git a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/AggregateTest.kt b/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/AggregateTest.kt deleted file mode 100644 index 37e368137f4..00000000000 --- a/repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/AggregateTest.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -import org.gradle.api.GradleException -import org.gradle.api.tasks.* -import org.gradle.api.tasks.testing.Test -import java.io.File - -// You can see "How To" via link: https://jetbrains.quip.com/xQ2WAUy9bZmy/How-to-use-AggregateTest-task -open class AggregateTest : Test() { // Inherit from Test to see test results in IDEA Test viewer - private var patterns: MutableMap> = mutableMapOf() - - @InputFile - lateinit var testPatternFile: File - - init { - // Set empty FileCollection to avoid NPE when initializing a base 'Test' class - classpath = project.objects.fileCollection() - testClassesDirs = project.objects.fileCollection() - - project.gradle.taskGraph.whenReady { - if (allTasks.filterIsInstance().isNotEmpty()) { - initPatterns() - allTasks.filterIsInstance().forEach { testTask -> subTaskConfigure(testTask) } - - if (!project.gradle.startParameter.taskNames.all { project.tasks.findByPath(it) is AggregateTest }) { - logger.warn("Please, don't use AggregateTest and non-AggregateTest test tasks together. You can get incorrect results.") - } - } - } - } - - private fun initPatterns() { - if (!testPatternFile.exists()) - throw GradleException("File with test patterns is not found") - testPatternFile - .readLines() - .asSequence() - .filter { it.isNotEmpty() } - .forEach { line -> - // patternType is exclude or include value - val (pattern, patternType) = line.split(',').map { it.trim() } - patterns.getOrPut(patternType) { mutableListOf() }.add(pattern) - } - } - - private fun subTaskConfigure(testTask: Test) { - testTask.doNotTrackState("State is tracked by AggregateTest task") - testTask.ignoreFailures = true - testTask.filter { - isFailOnNoMatchingTests = false - patterns["include"]?.let { - it.forEach { pattern -> - includeTestsMatching(pattern) - } - } - patterns["exclude"]?.let { - it.forEach { pattern -> - excludeTestsMatching(pattern) - } - } - } - } - - @Override - @TaskAction - override fun executeTests() { - // Do nothing - } -} \ No newline at end of file