Incremental KAPT - pass changed classpath entries
Pass computed list of changed classpath names to KAPT instead of relying on the history files to be computed by stub generation. Also, stop generating classpath history changes during the stub generation. This commit does not compute the actual changed classpath entries, and that will be done in the following commits. #KT-23880
This commit is contained in:
committed by
Alexey Tsvetkov
parent
0c09f56118
commit
c85e21d43b
+1
-1
@@ -313,7 +313,7 @@ abstract class IncrementalCompilerRunner<
|
||||
|
||||
open fun runWithNoDirtyKotlinSources(caches: CacheManager): Boolean = false
|
||||
|
||||
protected open fun processChangesAfterBuild(
|
||||
private fun processChangesAfterBuild(
|
||||
compilationMode: CompilationMode,
|
||||
currentBuildInfo: BuildInfo,
|
||||
dirtyData: DirtyData
|
||||
|
||||
+1
-24
@@ -109,8 +109,7 @@ class IncrementalJvmCompilerRunner(
|
||||
buildHistoryFile: File,
|
||||
outputFiles: Collection<File>,
|
||||
private val modulesApiHistory: ModulesApiHistory,
|
||||
override val kotlinSourceFilesExtensions: List<String> = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS,
|
||||
private val classpathFqNamesHistory: File? = null
|
||||
override val kotlinSourceFilesExtensions: List<String> = DEFAULT_KOTLIN_SOURCE_FILES_EXTENSIONS
|
||||
) : IncrementalCompilerRunner<K2JVMCompilerArguments, IncrementalJvmCachesManager>(
|
||||
workingDir,
|
||||
"caches-jvm",
|
||||
@@ -257,28 +256,6 @@ class IncrementalJvmCompilerRunner(
|
||||
}
|
||||
}
|
||||
|
||||
override fun processChangesAfterBuild(compilationMode: CompilationMode, currentBuildInfo: BuildInfo, dirtyData: DirtyData) {
|
||||
super.processChangesAfterBuild(compilationMode, currentBuildInfo, dirtyData)
|
||||
|
||||
classpathFqNamesHistory ?: return
|
||||
classpathFqNamesHistory.mkdirs()
|
||||
|
||||
val historyFiles = classpathFqNamesHistory.listFiles()
|
||||
if (dirtyClasspathChanges.isEmpty() && historyFiles.isNotEmpty()) {
|
||||
// Don't write an empty file. We check there is at least one file so that downstream task can mark what it has processed.
|
||||
return
|
||||
}
|
||||
|
||||
if (historyFiles.size > 10) {
|
||||
historyFiles.minBy { it.lastModified() }!!.delete()
|
||||
}
|
||||
val newHistoryFile = classpathFqNamesHistory.resolve(System.currentTimeMillis().toString())
|
||||
ObjectOutputStream(newHistoryFile.outputStream().buffered()).use {
|
||||
val listOfNames = dirtyClasspathChanges.map { it.toString() }.toList()
|
||||
it.writeObject(listOfNames)
|
||||
}
|
||||
}
|
||||
|
||||
override fun postCompilationHook(exitCode: ExitCode) {}
|
||||
|
||||
override fun updateCaches(
|
||||
|
||||
Reference in New Issue
Block a user