Invalidate jar cache at the end of a Gradle build
#KT-12912 fixed
This commit is contained in:
+4
@@ -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
|
||||
|
||||
+16
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
dependencies {
|
||||
compile project(':lib')
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
class A {
|
||||
fun f() {}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
fun useA(a: A) {
|
||||
a.f()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package foo
|
||||
|
||||
import bar.A
|
||||
|
||||
fun useA(a: A) {
|
||||
a.f()
|
||||
}
|
||||
+9
@@ -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"
|
||||
}
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
apply plugin: 'kotlin'
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package bar
|
||||
|
||||
class A {
|
||||
fun f() {}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
class Dummy
|
||||
+1
@@ -0,0 +1 @@
|
||||
include ':app', ':lib'
|
||||
Reference in New Issue
Block a user