[Gradle, JS] Make simple K/JS IC test to cover IR backend as well
This commit is contained in:
committed by
Space
parent
d2450268f6
commit
07c9cfd486
+30
-45
@@ -257,51 +257,6 @@ class Kotlin2JsIrGradlePluginIT : AbstractKotlin2JsGradlePluginIT(true) {
|
|||||||
|
|
||||||
@JsGradlePluginTests
|
@JsGradlePluginTests
|
||||||
class Kotlin2JsGradlePluginIT : AbstractKotlin2JsGradlePluginIT(false) {
|
class Kotlin2JsGradlePluginIT : AbstractKotlin2JsGradlePluginIT(false) {
|
||||||
|
|
||||||
@DisplayName("incremental compilation for js works")
|
|
||||||
@GradleTest
|
|
||||||
fun testIncrementalCompilation(gradleVersion: GradleVersion) {
|
|
||||||
val buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
|
||||||
project("kotlin2JsICProject", gradleVersion, buildOptions = buildOptions) {
|
|
||||||
val modules = listOf("app", "lib")
|
|
||||||
val mainFiles = modules.flatMapTo(LinkedHashSet()) {
|
|
||||||
projectPath.resolve("$it/src/main").allKotlinFiles
|
|
||||||
}
|
|
||||||
|
|
||||||
build("compileKotlinJs", "compileTestKotlinJs") {
|
|
||||||
checkIrCompilationMessage()
|
|
||||||
assertOutputContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
|
||||||
if (irBackend) {
|
|
||||||
assertCompiledKotlinSources(mainFiles.relativizeTo(projectPath), output)
|
|
||||||
} else {
|
|
||||||
assertCompiledKotlinSources(projectPath.allKotlinFiles.relativizeTo(projectPath), output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
build("compileKotlinJs", "compileTestKotlinJs") {
|
|
||||||
assertCompiledKotlinSources(emptyList(), output)
|
|
||||||
}
|
|
||||||
|
|
||||||
val modifiedFile = subProject("lib").kotlinSourcesDir().resolve("A.kt") ?: error("No A.kt file in test project")
|
|
||||||
modifiedFile.modify {
|
|
||||||
it.replace("val x = 0", "val x = \"a\"")
|
|
||||||
}
|
|
||||||
build("compileKotlinJs", "compileTestKotlinJs") {
|
|
||||||
checkIrCompilationMessage()
|
|
||||||
assertOutputContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
|
||||||
val affectedFiles = listOf("A.kt", "useAInLibMain.kt", "useAInAppMain.kt", "useAInAppTest.kt").mapNotNull {
|
|
||||||
projectPath.findInPath(it)
|
|
||||||
}
|
|
||||||
if (irBackend) {
|
|
||||||
// only klib ic is supported for now, so tests are generated non-incrementally with ir backend
|
|
||||||
assertCompiledKotlinSources(affectedFiles.filter { it in mainFiles }.relativizeTo(projectPath), output)
|
|
||||||
} else {
|
|
||||||
assertCompiledKotlinSources(affectedFiles.relativizeTo(projectPath), output)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@DisplayName("incremental compilation with multiple js modules after compilation error works")
|
@DisplayName("incremental compilation with multiple js modules after compilation error works")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testIncrementalCompilationWithMultipleModulesAfterCompilationError(gradleVersion: GradleVersion) {
|
fun testIncrementalCompilationWithMultipleModulesAfterCompilationError(gradleVersion: GradleVersion) {
|
||||||
@@ -734,6 +689,36 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("incremental compilation for js works")
|
||||||
|
@GradleTest
|
||||||
|
fun testIncrementalCompilation(gradleVersion: GradleVersion) {
|
||||||
|
val buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)
|
||||||
|
project("kotlin2JsICProject", gradleVersion, buildOptions = buildOptions) {
|
||||||
|
build("compileKotlinJs", "compileTestKotlinJs") {
|
||||||
|
checkIrCompilationMessage()
|
||||||
|
assertOutputContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
|
assertCompiledKotlinSources(projectPath.allKotlinFiles.relativizeTo(projectPath), output)
|
||||||
|
}
|
||||||
|
|
||||||
|
build("compileKotlinJs", "compileTestKotlinJs") {
|
||||||
|
assertCompiledKotlinSources(emptyList(), output)
|
||||||
|
}
|
||||||
|
|
||||||
|
val modifiedFile = subProject("lib").kotlinSourcesDir().resolve("A.kt") ?: error("No A.kt file in test project")
|
||||||
|
modifiedFile.modify {
|
||||||
|
it.replace("val x = 0", "val x = \"a\"")
|
||||||
|
}
|
||||||
|
build("compileKotlinJs", "compileTestKotlinJs") {
|
||||||
|
checkIrCompilationMessage()
|
||||||
|
assertOutputContains(USING_JS_INCREMENTAL_COMPILATION_MESSAGE)
|
||||||
|
val affectedFiles = listOf("A.kt", "useAInLibMain.kt", "useAInAppMain.kt", "useAInAppTest.kt").mapNotNull {
|
||||||
|
projectPath.findInPath(it)
|
||||||
|
}
|
||||||
|
assertCompiledKotlinSources(affectedFiles.relativizeTo(projectPath), output)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@DisplayName("non-incremental compilation works")
|
@DisplayName("non-incremental compilation works")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testIncrementalCompilationDisabled(gradleVersion: GradleVersion) {
|
fun testIncrementalCompilationDisabled(gradleVersion: GradleVersion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user