Test: use one function to find test's build log for jps and gradle
This commit is contained in:
+5
-10
@@ -3,18 +3,14 @@ package org.jetbrains.kotlin.gradle
|
||||
import org.gradle.api.logging.LogLevel
|
||||
import org.jetbrains.kotlin.gradle.incremental.BuildStep
|
||||
import org.jetbrains.kotlin.gradle.incremental.parseTestBuildLog
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.TouchPolicy
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.assertEqualDirectories
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.copyTestSources
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.getModificationsToPerform
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.*
|
||||
import org.junit.Assume
|
||||
import java.io.File
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
abstract class BaseIncrementalGradleIT : BaseGradleIT() {
|
||||
|
||||
inner class JpsTestProject(val resourcesBase: File, val relPath: String, wrapperVersion: String = "2.10", minLogLevel: LogLevel = LogLevel.DEBUG) : Project(File(relPath).name, wrapperVersion, minLogLevel) {
|
||||
inner class JpsTestProject(val buildLogFinder: BuildLogFinder, val resourcesBase: File, val relPath: String, wrapperVersion: String = "2.10", minLogLevel: LogLevel = LogLevel.DEBUG) : Project(File(relPath).name, wrapperVersion, minLogLevel) {
|
||||
override val resourcesRoot = File(resourcesBase, relPath)
|
||||
val mapWorkingToOriginalFile = hashMapOf<File, File>()
|
||||
|
||||
@@ -39,10 +35,9 @@ abstract class BaseIncrementalGradleIT : BaseGradleIT() {
|
||||
assertReportExists()
|
||||
}
|
||||
|
||||
val buildLogFile = resourcesRoot.listFiles { f: File -> f.name.endsWith("build.log") }?.sortedBy { it.length() }?.firstOrNull()
|
||||
assertNotNull(buildLogFile, "*build.log file not found" )
|
||||
|
||||
val buildLogSteps = parseTestBuildLog(buildLogFile!!)
|
||||
val buildLogFile = buildLogFinder.findBuildLog(resourcesRoot) ?:
|
||||
throw IllegalStateException("build log file not found in $resourcesRoot")
|
||||
val buildLogSteps = parseTestBuildLog(buildLogFile)
|
||||
val modifications = getModificationsToPerform(resourcesRoot,
|
||||
moduleNames = null,
|
||||
allowNoFilesWithSuffixInTestData = false,
|
||||
|
||||
+4
-2
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.Parameterized
|
||||
@@ -20,7 +21,7 @@ class KotlinGradlePluginJpsParametrizedCLIOnly : BaseIncrementalGradleIT() {
|
||||
|
||||
@Test
|
||||
fun testFromJps() {
|
||||
JpsTestProject(jpsResourcesPath, relativePath).performAndAssertBuildStages(weakTesting = true)
|
||||
JpsTestProject(buildLogFinder, jpsResourcesPath, relativePath).performAndAssertBuildStages(weakTesting = true)
|
||||
}
|
||||
|
||||
override fun defaultBuildOptions(): BuildOptions =
|
||||
@@ -33,6 +34,7 @@ class KotlinGradlePluginJpsParametrizedCLIOnly : BaseIncrementalGradleIT() {
|
||||
File(jpsResourcesPath, "changeIncrementalOption"),
|
||||
File(jpsResourcesPath, "custom"),
|
||||
File(jpsResourcesPath, "lookupTracker"))
|
||||
private val buildLogFinder = BuildLogFinder(isExperimentalEnabled = true)
|
||||
|
||||
@Suppress("unused")
|
||||
@Parameterized.Parameters(name = "{index}: {0}")
|
||||
@@ -40,7 +42,7 @@ class KotlinGradlePluginJpsParametrizedCLIOnly : BaseIncrementalGradleIT() {
|
||||
fun data(): List<Array<String>> =
|
||||
jpsResourcesPath.walk()
|
||||
.onEnter { it !in ignoredDirs }
|
||||
.filter { it.isDirectory && isJpsTestProject(it) }
|
||||
.filter { it.isDirectory && buildLogFinder.findBuildLog(it) != null }
|
||||
.map { arrayOf(it.toRelativeString(jpsResourcesPath)) }
|
||||
.toList()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user