From f1fcde76706d7b57452f7e7aab29cda321bf2377 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 18 Apr 2016 13:47:06 +0300 Subject: [PATCH] Do not store project in JPS tests after they're executed This saves a couple dozen megabytes currently Original commit: 2df8e56b94d74768687e5179baf3efd77ce55a57 --- .../jps/build/AbstractIncrementalJpsTest.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt index 9f6d141a814..30183d7a1fc 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/AbstractIncrementalJpsTest.kt @@ -58,7 +58,7 @@ import java.io.ByteArrayOutputStream import java.io.File import java.io.PrintStream import java.util.* -import kotlin.properties.Delegates +import kotlin.reflect.jvm.javaField abstract class AbstractIncrementalJpsTest( private val allowNoFilesWithSuffixInTestData: Boolean = false, @@ -80,13 +80,10 @@ abstract class AbstractIncrementalJpsTest( protected open val enableExperimentalIncrementalCompilation = false - protected var testDataDir: File by Delegates.notNull() - - protected var workDir: File by Delegates.notNull() - - protected var projectDescriptor: ProjectDescriptor by Delegates.notNull() - - protected var lookupsDuringTest: MutableSet by Delegates.notNull() + protected lateinit var testDataDir: File + protected lateinit var workDir: File + protected lateinit var projectDescriptor: ProjectDescriptor + protected lateinit var lookupsDuringTest: MutableSet protected var mapWorkingToOriginalFile: MutableMap = hashMapOf() @@ -105,7 +102,7 @@ abstract class AbstractIncrementalJpsTest( Logger.getRootLogger().addAppender(console) } - private val systemPropertiesBackup = run { + private var systemPropertiesBackup = run { val props = System.getProperties() val output = ByteArrayOutputStream() props.store(output, "System properties backup") @@ -132,6 +129,10 @@ abstract class AbstractIncrementalJpsTest( override fun tearDown() { restoreSystemProperties() + (AbstractIncrementalJpsTest::myProject).javaField!![this] = null + (AbstractIncrementalJpsTest::projectDescriptor).javaField!![this] = null + (AbstractIncrementalJpsTest::systemPropertiesBackup).javaField!![this] = null + lookupsDuringTest.clear() super.tearDown() }