Enable disabling incremental compilation for tests

Original commit: 68437175f6
This commit is contained in:
Alexey Tsvetkov
2015-09-24 23:26:53 +03:00
parent 20d6f01919
commit d591e31eee
4 changed files with 9 additions and 9 deletions
@@ -134,7 +134,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
val dataManager = projectDescriptor.dataManager val dataManager = projectDescriptor.dataManager
if (IncrementalCompilation.ENABLED && if (IncrementalCompilation.isEnabled() &&
chunk.targets.any { dataManager.dataPaths.getKotlinCacheVersion(it).isIncompatible() } chunk.targets.any { dataManager.dataPaths.getKotlinCacheVersion(it).isIncompatible() }
) { ) {
LOG.info("Clearing caches for " + chunk.targets.map { it.presentableName }.join()) LOG.info("Clearing caches for " + chunk.targets.map { it.presentableName }.join())
@@ -215,7 +215,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
copyJsLibraryFilesIfNeeded(chunk, project) copyJsLibraryFilesIfNeeded(chunk, project)
} }
if (!IncrementalCompilation.ENABLED) return OK if (!IncrementalCompilation.isEnabled()) return OK
val caches = filesToCompile.keySet().map { incrementalCaches[it]!! } val caches = filesToCompile.keySet().map { incrementalCaches[it]!! }
val marker = ChangesProcessor(context, chunk, allCompiledFiles, caches) val marker = ChangesProcessor(context, chunk, allCompiledFiles, caches)
@@ -293,8 +293,8 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
return compileToJs(chunk, commonArguments, environment, null, messageCollector, project) return compileToJs(chunk, commonArguments, environment, null, messageCollector, project)
} }
if (IncrementalCompilation.ENABLED) { if (IncrementalCompilation.isEnabled()) {
for (target in chunk.getTargets()) { for (target in chunk.targets) {
val cache = incrementalCaches[target]!! val cache = incrementalCaches[target]!!
val removedAndDirtyFiles = filesToCompile[target] + dirtyFilesHolder.getRemovedFiles(target).map { File(it) } val removedAndDirtyFiles = filesToCompile[target] + dirtyFilesHolder.getRemovedFiles(target).map { File(it) }
cache.markOutputClassesDirty(removedAndDirtyFiles) cache.markOutputClassesDirty(removedAndDirtyFiles)
@@ -410,7 +410,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
return sources return sources
} }
if (!IncrementalCompilation.ENABLED) { if (!IncrementalCompilation.isEnabled()) {
return return
} }
@@ -449,7 +449,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
): ChangesInfo { ): ChangesInfo {
incrementalCaches.values().forEach { it.saveCacheFormatVersion() } incrementalCaches.values().forEach { it.saveCacheFormatVersion() }
if (!IncrementalCompilation.ENABLED) { if (!IncrementalCompilation.isEnabled()) {
return ChangesInfo.NO_CHANGES return ChangesInfo.NO_CHANGES
} }
@@ -72,7 +72,7 @@ public class KotlinBuilderModuleScriptGenerator {
File outputDir = getOutputDirSafe(target); File outputDir = getOutputDirSafe(target);
List<File> moduleSources = new ArrayList<File>( List<File> moduleSources = new ArrayList<File>(
IncrementalCompilation.ENABLED IncrementalCompilation.isEnabled()
? sourceFiles.get(target) ? sourceFiles.get(target)
: KotlinSourceFileCollector.getAllKotlinSourceFiles(target)); : KotlinSourceFileCollector.getAllKotlinSourceFiles(target));
@@ -38,7 +38,7 @@ class CacheFormatVersion(targetDataRoot: File) {
private val file = File(targetDataRoot, FORMAT_VERSION_FILE_PATH) private val file = File(targetDataRoot, FORMAT_VERSION_FILE_PATH)
fun isIncompatible(): Boolean { fun isIncompatible(): Boolean {
assert(IncrementalCompilation.ENABLED) { "Incremental compilation is not enabled" } assert(IncrementalCompilation.isEnabled()) { "Incremental compilation is not enabled" }
if (!file.exists()) return false if (!file.exists()) return false
val versionNumber = file.readText().toInt() val versionNumber = file.readText().toInt()
@@ -83,7 +83,7 @@ public class KotlinModuleXmlBuilder {
) { ) {
p.println("<!-- Classpath -->"); p.println("<!-- Classpath -->");
for (File file : files) { for (File file : files) {
boolean isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.ENABLED; boolean isOutput = directoriesToFilterOut.contains(file) && !IncrementalCompilation.isEnabled();
if (isOutput) { if (isOutput) {
// For IDEA's make (incremental compilation) purposes, output directories of the current module and its dependencies // For IDEA's make (incremental compilation) purposes, output directories of the current module and its dependencies
// appear on the class path, so we are at risk of seeing the results of the previous build, i.e. if some class was // appear on the class path, so we are at risk of seeing the results of the previous build, i.e. if some class was