[Gradle] Add test for KT-56047
This commit is contained in:
committed by
Space Team
parent
81072ac9b4
commit
3cc69f691e
+34
@@ -166,4 +166,38 @@ class BuildCacheIT : KGPBaseTest() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DisplayName("Restore from build cache and consequent compilation error should not break incremental compilation")
|
||||||
|
@GradleTest
|
||||||
|
fun testIncrementalCompilationAfterCacheHitAndCompilationError(gradleVersion: GradleVersion) {
|
||||||
|
project("incrementalMultiproject", gradleVersion) {
|
||||||
|
enableLocalBuildCache(localBuildCacheDir)
|
||||||
|
build("assemble")
|
||||||
|
build("clean", "assemble") {
|
||||||
|
assertTasksFromCache(":lib:compileKotlin")
|
||||||
|
assertTasksFromCache(":app:compileKotlin")
|
||||||
|
}
|
||||||
|
val bKtSourceFile = projectPath.resolve("lib/src/main/kotlin/bar/B.kt")
|
||||||
|
|
||||||
|
bKtSourceFile.modify { it.replace("fun b() {}", "fun b() {}\nfun b2) {}") }
|
||||||
|
|
||||||
|
buildAndFail("assemble", buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)) {
|
||||||
|
assertTasksFailed(":lib:compileKotlin")
|
||||||
|
assertOutputDoesNotContain("On recompilation full rebuild will be performed")
|
||||||
|
val affectedFiles = setOf(
|
||||||
|
bKtSourceFile,
|
||||||
|
)
|
||||||
|
assertCompiledKotlinSources(affectedFiles.relativizeTo(projectPath), output)
|
||||||
|
}
|
||||||
|
|
||||||
|
bKtSourceFile.modify { it.replace("fun b2) {}", "fun b2() {}") }
|
||||||
|
|
||||||
|
build("assemble", buildOptions = defaultBuildOptions.copy(logLevel = LogLevel.DEBUG)) {
|
||||||
|
val affectedFiles = setOf(
|
||||||
|
bKtSourceFile,
|
||||||
|
subProject("app").kotlinSourcesDir().resolve("foo/BB.kt"),
|
||||||
|
)
|
||||||
|
assertIncrementalCompilation(expectedCompiledKotlinFiles = affectedFiles.relativizeTo(projectPath))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user