Add test for missing lz4 dependency

Adds Gradle test for the exception:
`java.lang.ClassNotFoundException: net.jpountz.lz4.LZ4Factory`

The exception breaks IC in Gradle. Gradle compiles non-incrementally as
a fallback strategy, so the build succeeds, but IC is not working.

IC uses persistent hash tables from Intellij as caches.
These tables's buffers are compressed when full.
Previously snappy was used for compression, but 181 platform switched to
LZ4, which was cut out by proguard.

The problem could only be reproduced with Gradle,
since in JPS plugin all caches are managed by JPS process,
which contains the necessary library.

To reproduce the compiler needs to be processed by proguard
(which always happens on TeamCity).
Many classes are needed to trigger the compression.
This commit is contained in:
Alexey Tsvetkov
2018-05-11 19:28:58 +03:00
committed by Ilya Chernikov
parent e329af0932
commit 38ffd6f85e
5 changed files with 60 additions and 0 deletions
@@ -208,6 +208,28 @@ class KotlinGradleIT : BaseGradleIT() {
}
}
@Test
fun testManyClassesIC() {
val project = Project("manyClasses")
val options = defaultBuildOptions().copy(incremental = true)
project.setupWorkingDir()
val classesKt = project.projectFile("classes.kt")
classesKt.writeText((0..1024).joinToString("\n") { "class Class$it { fun f() = $it }" })
project.build("build", options = options) {
assertSuccessful()
assertNoWarnings()
}
val dummyKt = project.projectFile("dummy.kt")
dummyKt.modify { "$it " }
project.build("build", options = options) {
assertSuccessful()
assertCompiledKotlinSources(project.relativize(dummyKt))
}
}
@Test
fun testSimpleMultiprojectIncremental() {
val incremental = defaultBuildOptions().copy(incremental = true)
@@ -0,0 +1,20 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "kotlin"
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-runtime:$kotlin_version"
}
@@ -0,0 +1 @@
org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m
@@ -0,0 +1,7 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
// Actual classes are generated in KotlinGradleIT.testManyClasses
<!PLACEHOLDER!>
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package foo
fun dummy() {
}