Remove old IC: remove IncrementalCompilation.isExperimental

This commit is contained in:
Alexey Tsvetkov
2017-04-26 13:57:22 +03:00
parent 50091bfac8
commit 2bd7d12312
14 changed files with 18 additions and 46 deletions
@@ -112,7 +112,7 @@ fun experimentalCacheVersion(dataRoot: File): CacheVersion =
whenVersionChanged = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOn = CacheVersion.Action.REBUILD_CHUNK,
whenTurnedOff = CacheVersion.Action.CLEAN_EXPERIMENTAL_CACHES,
isEnabled = { IncrementalCompilation.isExperimental() })
isEnabled = { IncrementalCompilation.isEnabled() })
fun dataContainerCacheVersion(dataRoot: File): CacheVersion =
CacheVersion(ownVersion = DATA_CONTAINER_VERSION,
@@ -120,4 +120,4 @@ fun dataContainerCacheVersion(dataRoot: File): CacheVersion =
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOff = CacheVersion.Action.CLEAN_DATA_CONTAINER,
isEnabled = { IncrementalCompilation.isExperimental() })
isEnabled = { IncrementalCompilation.isEnabled() })
@@ -165,7 +165,7 @@ open class IncrementalCacheImpl<Target>(
sourceToClassesMap.add(it, className)
}
if (IncrementalCompilation.isExperimental()) {
if (IncrementalCompilation.isEnabled()) {
internalNameToSource[className.internalName] = sourceFiles
}
@@ -290,7 +290,7 @@ open class IncrementalCacheImpl<Target>(
.toList()
val changes =
if (IncrementalCompilation.isExperimental())
if (IncrementalCompilation.isEnabled())
dirtyClasses.flatMap { computeChanges(it, ::Removed) }.asSequence()
else
emptySequence<ChangeInfo>()
@@ -416,7 +416,7 @@ open class IncrementalCacheImpl<Target>(
if (oldData == null) {
val changes =
if (IncrementalCompilation.isExperimental())
if (IncrementalCompilation.isEnabled())
computeChanges(className, ::MembersChanged).asSequence()
else
emptySequence<ChangeInfo>()
@@ -492,7 +492,7 @@ open class IncrementalCacheImpl<Target>(
}
val changes =
if (!IncrementalCompilation.isExperimental() ||
if (!IncrementalCompilation.isEnabled() ||
constantsMap == null || constantsMap.isEmpty() ||
oldMap == null || oldMap.isEmpty()
) {
@@ -617,7 +617,7 @@ open class IncrementalCacheImpl<Target>(
}
private fun addToClassStorage(kotlinClass: LocalFileKotlinClass, srcFile: File) {
if (!IncrementalCompilation.isExperimental()) return
if (!IncrementalCompilation.isEnabled()) return
val classData = JvmProtoBufUtil.readClassDataFrom(kotlinClass.classHeader.data!!, kotlinClass.classHeader.strings!!)
val supertypes = classData.classProto.supertypes(TypeTable(classData.classProto.typeTable))
@@ -636,7 +636,7 @@ open class IncrementalCacheImpl<Target>(
}
private fun removeAllFromClassStorage(removedClasses: Collection<JvmClassName>) {
if (!IncrementalCompilation.isExperimental() || removedClasses.isEmpty()) return
if (!IncrementalCompilation.isEnabled() || removedClasses.isEmpty()) return
val removedFqNames = removedClasses.map { it.fqNameForClassNameWithoutDollars }.toSet()
@@ -738,7 +738,7 @@ open class IncrementalCacheImpl<Target>(
}
val changes =
if (IncrementalCompilation.isExperimental()) {
if (IncrementalCompilation.isEnabled()) {
val fqName = if (isPackage) className.packageFqName else className.fqNameForClassNameWithoutDollars
// TODO get name in better way instead of using substringBefore
(added.asSequence() + changed.asSequence()).map { ChangeInfo.MembersChanged(fqName, listOf(it.substringBefore("("))) }
@@ -79,7 +79,7 @@ fun makeCompileServices(
}
fun makeLookupTracker(parentLookupTracker: LookupTracker = LookupTracker.DO_NOTHING): LookupTracker =
if (IncrementalCompilation.isExperimental()) LookupTrackerImpl(parentLookupTracker)
if (IncrementalCompilation.isEnabled()) LookupTrackerImpl(parentLookupTracker)
else parentLookupTracker
fun<Target> makeIncrementalCachesMap(
@@ -73,16 +73,13 @@ private object EmptyICReporter : ICReporter {
inline fun <R> withIC(fn: ()->R): R {
val isEnabledBackup = IncrementalCompilation.isEnabled()
val isExperimentalBackup = IncrementalCompilation.isExperimental()
IncrementalCompilation.setIsEnabled(true)
IncrementalCompilation.setIsExperimental(true)
try {
return fn()
}
finally {
IncrementalCompilation.setIsEnabled(isEnabledBackup)
IncrementalCompilation.setIsExperimental(isExperimentalBackup)
}
}
@@ -259,7 +256,6 @@ class IncrementalJvmCompilerRunner(
messageCollector: MessageCollector
): ExitCode {
assert(IncrementalCompilation.isEnabled()) { "Incremental compilation is not enabled" }
assert(IncrementalCompilation.isExperimental()) { "Experimental incremental compilation is not enabled" }
val allGeneratedFiles = hashSetOf<GeneratedFile<TargetId>>()
val dirtySources: MutableList<File>
@@ -31,7 +31,7 @@ fun customCacheVersion(version: Int, fileName: String, dataRoot: File, forceEnab
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
whenTurnedOff = CacheVersion.Action.REBUILD_ALL_KOTLIN,
isEnabled = { IncrementalCompilation.isExperimental() || forceEnable })
isEnabled = { IncrementalCompilation.isEnabled() || forceEnable })
fun commonCacheVersions(cachesDir: File): List<CacheVersion> =
listOf(normalCacheVersion(cachesDir),
@@ -20,11 +20,6 @@ import org.jetbrains.annotations.TestOnly;
public class IncrementalCompilation {
private static final String INCREMENTAL_COMPILATION_PROPERTY = "kotlin.incremental.compilation";
private static final String IS_EXPERIMENTAL_PROPERTY = "kotlin.incremental.compilation.experimental";
public static boolean isExperimental() {
return isEnabled() && "true".equals(System.getProperty(IS_EXPERIMENTAL_PROPERTY));
}
public static boolean isEnabled() {
return !"false".equals(System.getProperty(INCREMENTAL_COMPILATION_PROPERTY));
@@ -34,9 +29,4 @@ public class IncrementalCompilation {
public static void setIsEnabled(boolean value) {
System.setProperty(INCREMENTAL_COMPILATION_PROPERTY, String.valueOf(value));
}
@TestOnly
public static void setIsExperimental(boolean value) {
System.setProperty(IS_EXPERIMENTAL_PROPERTY, String.valueOf(value));
}
}
@@ -25,7 +25,7 @@ class KotlinBuildProcessParametersProvider(private val compilerWorkspaceSettings
override fun getVMArguments(): MutableList<String> {
val res = arrayListOf<String>()
if (compilerWorkspaceSettings.preciseIncrementalEnabled) {
res.add("-Dkotlin.incremental.compilation.experimental=true")
res.add("-Dkotlin.incremental.compilation=true")
}
if (compilerWorkspaceSettings.enableDaemon) {
res.add("-Dkotlin.daemon.enabled")
@@ -71,8 +71,6 @@ abstract class AbstractIncrementalJpsTest(
private val DEBUG_LOGGING_ENABLED = System.getProperty("debug.logging.enabled") == "true"
}
protected open val enableExperimentalIncrementalCompilation = false
protected lateinit var testDataDir: File
protected lateinit var workDir: File
protected lateinit var projectDescriptor: ProjectDescriptor
@@ -81,7 +79,7 @@ abstract class AbstractIncrementalJpsTest(
protected var mapWorkingToOriginalFile: MutableMap<File, File> = hashMapOf()
protected open val buildLogFinder: BuildLogFinder
get() = BuildLogFinder(isExperimentalEnabled = enableExperimentalIncrementalCompilation)
get() = BuildLogFinder(isExperimentalEnabled = true)
private fun enableDebugLogging() {
com.intellij.openapi.diagnostic.Logger.setFactory(TestLoggerFactory::class.java)
@@ -112,7 +110,7 @@ abstract class AbstractIncrementalJpsTest(
override fun setUp() {
super.setUp()
lookupsDuringTest = hashSetOf()
IncrementalCompilation.setIsExperimental(enableExperimentalIncrementalCompilation)
IncrementalCompilation.setIsEnabled(true)
if (DEBUG_LOGGING_ENABLED) {
enableDebugLogging()
@@ -279,8 +277,6 @@ abstract class AbstractIncrementalJpsTest(
throw IllegalStateException("No build log file in $testDataDir")
}
if (!enableExperimentalIncrementalCompilation && File(testDataDir, "dont-check-caches-in-non-experimental-ic.txt").exists()) return
val lastMakeResult = otherMakeResults.last()
rebuildAndCheckOutput(lastMakeResult)
clearCachesRebuildAndCheckOutput(lastMakeResult)
@@ -55,7 +55,7 @@ abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest()
IncrementalCompilation.setIsEnabled(modification.dataFile.readAsBool())
}
name.endsWith("experimental-compilation") -> {
IncrementalCompilation.setIsExperimental(modification.dataFile.readAsBool())
IncrementalCompilation.setIsEnabled(modification.dataFile.readAsBool())
}
}
}
@@ -20,12 +20,9 @@ import org.jetbrains.jps.incremental.ModuleBuildTarget
import org.jetbrains.kotlin.incremental.testingUtils.BuildLogFinder
import org.jetbrains.kotlin.jps.incremental.CacheVersionProvider
abstract class AbstractExperimentalIncrementalJpsTest : AbstractIncrementalJpsTest() {
override val enableExperimentalIncrementalCompilation = true
}
abstract class AbstractExperimentalIncrementalJpsTest : AbstractIncrementalJpsTest()
abstract class AbstractExperimentalIncrementalLazyCachesTest : AbstractIncrementalLazyCachesTest() {
override val enableExperimentalIncrementalCompilation = true
override val expectedCachesFileName: String
get() = "experimental-expected-kotlin-caches.txt"
@@ -34,8 +31,6 @@ abstract class AbstractExperimentalIncrementalLazyCachesTest : AbstractIncrement
abstract class AbstractExperimentalChangeIncrementalOptionTest : AbstractIncrementalLazyCachesTest()
abstract class AbstractExperimentalIncrementalCacheVersionChangedTest : AbstractIncrementalCacheVersionChangedTest() {
override val enableExperimentalIncrementalCompilation = true
override fun getVersions(cacheVersionProvider: CacheVersionProvider, targets: Iterable<ModuleBuildTarget>) =
targets.map { cacheVersionProvider.experimentalVersion(it) }
}
@@ -29,5 +29,4 @@ open class IncrementalRenameModuleTest : AbstractIncrementalJpsTest() {
}
class ExperimentalIncrementalRenameModuleTest : IncrementalRenameModuleTest() {
override val enableExperimentalIncrementalCompilation = true
}
@@ -92,7 +92,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
override fun buildStarted(context: CompileContext) {
LOG.debug("==========================================")
LOG.info("is Kotlin incremental compilation enabled: ${IncrementalCompilation.isEnabled()}")
LOG.info("is Kotlin experimental incremental compilation enabled: ${IncrementalCompilation.isExperimental()}")
LOG.info("is Kotlin compiler daemon enabled: ${isDaemonEnabled()}")
val historyLabel = context.getBuilderParameter("history label")
@@ -643,8 +642,6 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
dirtyFilesHolder: DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget>,
filesToCompile: MultiMap<ModuleBuildTarget, File>
) {
if (!IncrementalCompilation.isExperimental()) return
if (lookupTracker !is LookupTrackerImpl) throw AssertionError("Lookup tracker is expected to be LookupTrackerImpl, got ${lookupTracker::class.java}")
val lookupStorage = dataManager.getStorage(KotlinDataContainerTarget, JpsLookupStorageProvider)
@@ -845,7 +842,7 @@ private fun CompilationResult.processChangesUsingLookups(
private fun getLookupTracker(project: JpsProject): LookupTracker {
val testLookupTracker = project.testingContext?.lookupTracker ?: LookupTracker.DO_NOTHING
if (IncrementalCompilation.isExperimental()) return LookupTrackerImpl(testLookupTracker)
if (IncrementalCompilation.isEnabled()) return LookupTrackerImpl(testLookupTracker)
return testLookupTracker
}
@@ -45,7 +45,7 @@ class JpsIncrementalCacheImpl(
private val inlinedTo = registerMap(InlineFunctionsFilesMap(INLINED_TO.storageFile))
override fun registerInline(fromPath: String, jvmSignature: String, toPath: String) {
if (!IncrementalCompilation.isExperimental()) {
if (!IncrementalCompilation.isEnabled()) {
inlinedTo.add(fromPath, jvmSignature, toPath)
}
}
@@ -94,7 +94,6 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
field = value
logger.kotlinDebug { "Set $this.incremental=$value" }
System.setProperty("kotlin.incremental.compilation", value.toString())
System.setProperty("kotlin.incremental.compilation.experimental", value.toString())
}
private lateinit var destinationDirProvider: Lazy<File>