Do not mark dirty same files
This commit is contained in:
@@ -16,13 +16,18 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.jps.build
|
package org.jetbrains.kotlin.jps.build
|
||||||
|
|
||||||
|
import com.intellij.openapi.diagnostic.Logger
|
||||||
import org.jetbrains.jps.ModuleChunk
|
import org.jetbrains.jps.ModuleChunk
|
||||||
import org.jetbrains.jps.incremental.CompileContext
|
import org.jetbrains.jps.incremental.CompileContext
|
||||||
import org.jetbrains.jps.incremental.FSOperations
|
import org.jetbrains.jps.incremental.FSOperations
|
||||||
import org.jetbrains.jps.incremental.fs.CompilationRound
|
import org.jetbrains.jps.incremental.fs.CompilationRound
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class FSOperationsHelper(private val compileContext: CompileContext, private val chunk: ModuleChunk) {
|
class FSOperationsHelper(
|
||||||
|
private val compileContext: CompileContext,
|
||||||
|
private val chunk: ModuleChunk,
|
||||||
|
private val log: Logger
|
||||||
|
) {
|
||||||
private var markedDirty = false
|
private var markedDirty = false
|
||||||
|
|
||||||
fun hasMarkedDirty(): Boolean = markedDirty
|
fun hasMarkedDirty(): Boolean = markedDirty
|
||||||
@@ -46,11 +51,16 @@ class FSOperationsHelper(private val compileContext: CompileContext, private val
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun markFiles(files: Iterable<File>, excludeFiles: Set<File> = setOf()) {
|
fun markFiles(files: Iterable<File>, excludeFiles: Set<File> = setOf()) {
|
||||||
for (file in files) {
|
val filesToMark = files.toMutableSet()
|
||||||
if (file in excludeFiles || !file.exists()) continue
|
filesToMark.removeAll(excludeFiles)
|
||||||
|
log.debug("Mark dirty: $filesToMark")
|
||||||
|
|
||||||
|
for (file in filesToMark) {
|
||||||
|
if (!file.exists()) continue
|
||||||
|
|
||||||
FSOperations.markDirty(compileContext, CompilationRound.NEXT, file)
|
FSOperations.markDirty(compileContext, CompilationRound.NEXT, file)
|
||||||
markedDirty = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
markedDirty = markedDirty || filesToMark.isNotEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
|||||||
): ModuleLevelBuilder.ExitCode {
|
): ModuleLevelBuilder.ExitCode {
|
||||||
LOG.debug("------------------------------------------")
|
LOG.debug("------------------------------------------")
|
||||||
val messageCollector = MessageCollectorAdapter(context)
|
val messageCollector = MessageCollectorAdapter(context)
|
||||||
val fsOperations = FSOperationsHelper(context, chunk)
|
val fsOperations = FSOperationsHelper(context, chunk, LOG)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val exitCode = doBuild(chunk, context, dirtyFilesHolder, messageCollector, outputConsumer, fsOperations)
|
val exitCode = doBuild(chunk, context, dirtyFilesHolder, messageCollector, outputConsumer, fsOperations)
|
||||||
@@ -275,9 +275,8 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inlineChanged) {
|
if (inlineChanged) {
|
||||||
for (cache in caches) {
|
val files = caches.flatMap { it.getFilesToReinline() }
|
||||||
fsOperations.markFiles(cache.getFilesToReinline(), excludeFiles = compiledFiles)
|
fsOperations.markFiles(files, excludeFiles = compiledFiles)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user