Invalidate jar cache at the end of a Gradle build

#KT-12912 fixed
This commit is contained in:
Alexey Tsvetkov
2016-08-08 15:44:03 +03:00
parent fa0344a1b2
commit 791c7fe6e6
12 changed files with 61 additions and 0 deletions
@@ -21,8 +21,10 @@ import org.gradle.BuildAdapter
import org.gradle.BuildResult
import org.gradle.api.Project
import org.gradle.api.logging.Logging
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.com.intellij.openapi.util.io.ZipFileCache
import org.jetbrains.kotlin.com.intellij.openapi.vfs.impl.ZipHandler
import org.jetbrains.kotlin.com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem
private fun comparableVersionStr(version: String) =
@@ -108,6 +110,8 @@ class CompilerServicesCleanup() {
cleanJarCache()
}
(KotlinCoreEnvironment.applicationEnvironment?.jarFileSystem as? CoreJarFileSystem)?.clearHandlersCache()
// making cleanup of static objects only on recognized versions of gradle and if version < 2.4
// otherwise it may cause problems e.g. with JobScheduler on subsequent runs
// this strategy may lead to memory leaks, but prevent crashes due to destroyed JobScheduler
@@ -246,4 +246,20 @@ class KotlinGradleIT: BaseGradleIT() {
assertContains(":compileKotlin UP-TO-DATE")
}
}
@Test
fun testMoveClassToOtherModule() {
val project = Project("moveClassToOtherModule", GRADLE_VERSION)
project.build("build") {
assertSuccessful()
assertContains("Connected to daemon")
}
project.performModifications()
project.build("build") {
assertSuccessful()
assertContains("Connected to daemon")
}
}
}
@@ -0,0 +1,5 @@
apply plugin: 'kotlin'
dependencies {
compile project(':lib')
}
@@ -0,0 +1,7 @@
package foo
import bar.A
fun useA(a: A) {
a.f()
}
@@ -0,0 +1,9 @@
buildscript {
ext.kotlin_version = '1.1-SNAPSHOT'
repositories {
maven { url 'file://' + pathToKotlinPlugin }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}