Add JS specific build logs to inline properties IC tests

Unlike the JVM target platform, the JS back-end does
not track getters' and setters' usages separately,
so when either accessor of some property is changed,
all usages of that property will be rebuilt.
This commit is contained in:
Alexey Tsvetkov
2017-08-24 04:11:28 +03:00
parent 73b63bb343
commit 5f9bad5905
5 changed files with 50 additions and 4 deletions
@@ -18,11 +18,13 @@ package org.jetbrains.kotlin.incremental.testingUtils
import java.io.File import java.io.File
class BuildLogFinder( data class BuildLogFinder(
private val isDataContainerBuildLogEnabled: Boolean = false, private val isDataContainerBuildLogEnabled: Boolean = false,
private val isGradleEnabled: Boolean = false private val isGradleEnabled: Boolean = false,
private val isJsEnabled: Boolean = false
) { ) {
companion object { companion object {
private const val JS_LOG = "js-build.log"
private const val GRADLE_LOG = "gradle-build.log" private const val GRADLE_LOG = "gradle-build.log"
private const val DATA_CONTAINER_LOG = "data-container-version-build.log" private const val DATA_CONTAINER_LOG = "data-container-version-build.log"
private const val SIMPLE_LOG = "build.log" private const val SIMPLE_LOG = "build.log"
@@ -32,6 +34,7 @@ class BuildLogFinder(
val names = dir.list() ?: arrayOf() val names = dir.list() ?: arrayOf()
val files = names.filter { File(dir, it).isFile }.toSet() val files = names.filter { File(dir, it).isFile }.toSet()
val matchedName = when { val matchedName = when {
isJsEnabled && JS_LOG in files -> JS_LOG
isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG isGradleEnabled && GRADLE_LOG in files -> GRADLE_LOG
isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG isDataContainerBuildLogEnabled && DATA_CONTAINER_LOG in files -> DATA_CONTAINER_LOG
SIMPLE_LOG in files -> SIMPLE_LOG SIMPLE_LOG in files -> SIMPLE_LOG
@@ -102,6 +102,9 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
} }
} }
protected open val buildLogFinder: BuildLogFinder
get() = BuildLogFinder(isGradleEnabled = true)
protected abstract fun make(cacheDir: File, sourceRoots: Iterable<File>, args: Args): TestCompilationResult protected abstract fun make(cacheDir: File, sourceRoots: Iterable<File>, args: Args): TestCompilationResult
private fun stepLogAsString(step: Int, ktSources: Iterable<String>, errors: Collection<String>, includeErrors: Boolean = true): String { private fun stepLogAsString(step: Int, ktSources: Iterable<String>, errors: Collection<String>, includeErrors: Boolean = true): String {
@@ -134,7 +137,5 @@ abstract class AbstractIncrementalCompilerRunnerTestBase<Args : CommonCompilerAr
companion object { companion object {
@JvmStatic @JvmStatic
protected val bootstrapKotlincLib: File = File("dependencies/bootstrap-compiler/Kotlin/kotlinc/lib") protected val bootstrapKotlincLib: File = File("dependencies/bootstrap-compiler/Kotlin/kotlinc/lib")
private val buildLogFinder = BuildLogFinder(isGradleEnabled = true)
} }
} }
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.incremental package org.jetbrains.kotlin.incremental
import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments import org.jetbrains.kotlin.cli.common.arguments.K2JSCompilerArguments
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.incremental.utils.TestCompilationResult import org.jetbrains.kotlin.incremental.utils.TestCompilationResult
import org.jetbrains.kotlin.incremental.utils.TestICReporter import org.jetbrains.kotlin.incremental.utils.TestICReporter
import org.jetbrains.kotlin.incremental.utils.TestMessageCollector import org.jetbrains.kotlin.incremental.utils.TestMessageCollector
@@ -30,6 +31,9 @@ abstract class AbstractIncrementalJsCompilerRunnerTest : AbstractIncrementalComp
return TestCompilationResult(reporter, messageCollector) return TestCompilationResult(reporter, messageCollector)
} }
override val buildLogFinder: BuildLogFinder
get() = super.buildLogFinder.copy(isJsEnabled = true)
override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments = override fun createCompilerArguments(destinationDir: File, testDir: File): K2JSCompilerArguments =
K2JSCompilerArguments().apply { K2JSCompilerArguments().apply {
outputFile = File(destinationDir, "${testDir.name}.js").path outputFile = File(destinationDir, "${testDir.name}.js").path
@@ -0,0 +1,19 @@
================ Step #1 =================
Compiling files:
src/inline.kt
src/useGetter.kt
src/useSetter.kt
End of files
Exit code: OK
------------------------------------------
================ Step #2 =================
Compiling files:
src/inline.kt
src/useGetter.kt
src/useSetter.kt
End of files
Exit code: OK
------------------------------------------
@@ -0,0 +1,19 @@
================ Step #1 =================
Compiling files:
src/inline.kt
src/useGetter.kt
src/useSetter.kt
End of files
Exit code: OK
------------------------------------------
================ Step #2 =================
Compiling files:
src/inline.kt
src/useGetter.kt
src/useSetter.kt
End of files
Exit code: OK
------------------------------------------