Unify Gradle and Kotlin daemon cache version checking
This commit is contained in:
+6
@@ -34,6 +34,12 @@ interface IncrementalCompilationServicesFacade : Remote {
|
|||||||
@Throws(RemoteException::class)
|
@Throws(RemoteException::class)
|
||||||
fun workingDir(): File
|
fun workingDir(): File
|
||||||
|
|
||||||
|
@Throws(RemoteException::class)
|
||||||
|
fun customCacheVersionFileName(): String
|
||||||
|
|
||||||
|
@Throws(RemoteException::class)
|
||||||
|
fun customCacheVersion(): Int
|
||||||
|
|
||||||
// ICReporter
|
// ICReporter
|
||||||
|
|
||||||
@Throws(RemoteException::class)
|
@Throws(RemoteException::class)
|
||||||
|
|||||||
@@ -362,7 +362,8 @@ class CompileServiceImpl(
|
|||||||
val changesRegistry = RemoteChangesRegostry(servicesFacade)
|
val changesRegistry = RemoteChangesRegostry(servicesFacade)
|
||||||
|
|
||||||
val workingDir = servicesFacade.workingDir()
|
val workingDir = servicesFacade.workingDir()
|
||||||
val versions = commonCacheVersions(workingDir) + standaloneCacheVersion(workingDir, forceEnable = true)
|
val versions = commonCacheVersions(workingDir) +
|
||||||
|
customCacheVersion(servicesFacade.customCacheVersion(), servicesFacade.customCacheVersionFileName(), workingDir, forceEnable = true)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
printStream.print(renderer.renderPreamble())
|
printStream.print(renderer.renderPreamble())
|
||||||
|
|||||||
+6
-3
@@ -22,9 +22,12 @@ import java.io.File
|
|||||||
internal const val STANDALONE_CACHE_VERSION = 0
|
internal const val STANDALONE_CACHE_VERSION = 0
|
||||||
internal const val STANDALONE_VERSION_FILE_NAME = "standalone-ic-format-version.txt"
|
internal const val STANDALONE_VERSION_FILE_NAME = "standalone-ic-format-version.txt"
|
||||||
|
|
||||||
fun standaloneCacheVersion(dataRoot: File, forceEnable: Boolean = false): CacheVersion =
|
fun standaloneCacheVersion(dataRoot: File): CacheVersion =
|
||||||
CacheVersion(ownVersion = STANDALONE_CACHE_VERSION,
|
customCacheVersion(STANDALONE_CACHE_VERSION, STANDALONE_VERSION_FILE_NAME, dataRoot)
|
||||||
versionFile = File(dataRoot, STANDALONE_VERSION_FILE_NAME),
|
|
||||||
|
fun customCacheVersion(version: Int, fileName: String, dataRoot: File, forceEnable: Boolean = false): CacheVersion =
|
||||||
|
CacheVersion(ownVersion = version,
|
||||||
|
versionFile = File(dataRoot, fileName),
|
||||||
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
||||||
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
||||||
whenTurnedOff = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
whenTurnedOff = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
||||||
|
|||||||
+8
@@ -25,6 +25,8 @@ import org.jetbrains.kotlin.daemon.incremental.toDirtyData
|
|||||||
import org.jetbrains.kotlin.daemon.incremental.toSimpleDirtyData
|
import org.jetbrains.kotlin.daemon.incremental.toSimpleDirtyData
|
||||||
import org.jetbrains.kotlin.incremental.ChangedFiles
|
import org.jetbrains.kotlin.incremental.ChangedFiles
|
||||||
import org.jetbrains.kotlin.incremental.DirtyData
|
import org.jetbrains.kotlin.incremental.DirtyData
|
||||||
|
import org.jetbrains.kotlin.incremental.GRADLE_CACHE_VERSION
|
||||||
|
import org.jetbrains.kotlin.incremental.GRADLE_CACHE_VERSION_FILE_NAME
|
||||||
import org.jetbrains.kotlin.incremental.multiproject.ArtifactDifference
|
import org.jetbrains.kotlin.incremental.multiproject.ArtifactDifference
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -64,6 +66,12 @@ internal class IncrementalCompilationFacadeImpl(
|
|||||||
return environment.workingDir
|
return environment.workingDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun customCacheVersion(): Int =
|
||||||
|
GRADLE_CACHE_VERSION
|
||||||
|
|
||||||
|
override fun customCacheVersionFileName(): String =
|
||||||
|
GRADLE_CACHE_VERSION_FILE_NAME
|
||||||
|
|
||||||
override fun hasAnnotationsFileUpdater(): Boolean {
|
override fun hasAnnotationsFileUpdater(): Boolean {
|
||||||
return environment.kaptAnnotationsFileUpdater != null
|
return environment.kaptAnnotationsFileUpdater != null
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -26,6 +26,7 @@ import org.gradle.api.tasks.SourceTask
|
|||||||
import org.gradle.api.tasks.TaskAction
|
import org.gradle.api.tasks.TaskAction
|
||||||
import org.gradle.api.tasks.compile.AbstractCompile
|
import org.gradle.api.tasks.compile.AbstractCompile
|
||||||
import org.gradle.api.tasks.incremental.IncrementalTaskInputs
|
import org.gradle.api.tasks.incremental.IncrementalTaskInputs
|
||||||
|
import org.gradle.util.GradleVersion
|
||||||
import org.jetbrains.kotlin.annotation.AnnotationFileUpdater
|
import org.jetbrains.kotlin.annotation.AnnotationFileUpdater
|
||||||
import org.jetbrains.kotlin.annotation.AnnotationFileUpdaterImpl
|
import org.jetbrains.kotlin.annotation.AnnotationFileUpdaterImpl
|
||||||
import org.jetbrains.kotlin.cli.common.CLICompiler
|
import org.jetbrains.kotlin.cli.common.CLICompiler
|
||||||
|
|||||||
+1
-7
@@ -16,16 +16,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.incremental
|
package org.jetbrains.kotlin.incremental
|
||||||
|
|
||||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal const val GRADLE_CACHE_VERSION = 3
|
internal const val GRADLE_CACHE_VERSION = 3
|
||||||
internal const val GRADLE_CACHE_VERSION_FILE_NAME = "gradle-format-version.txt"
|
internal const val GRADLE_CACHE_VERSION_FILE_NAME = "gradle-format-version.txt"
|
||||||
|
|
||||||
internal fun gradleCacheVersion(dataRoot: File): CacheVersion =
|
internal fun gradleCacheVersion(dataRoot: File): CacheVersion =
|
||||||
CacheVersion(ownVersion = GRADLE_CACHE_VERSION,
|
customCacheVersion(GRADLE_CACHE_VERSION, GRADLE_CACHE_VERSION_FILE_NAME, dataRoot)
|
||||||
versionFile = File(dataRoot, GRADLE_CACHE_VERSION_FILE_NAME),
|
|
||||||
whenVersionChanged = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
|
||||||
whenTurnedOn = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
|
||||||
whenTurnedOff = CacheVersion.Action.REBUILD_ALL_KOTLIN,
|
|
||||||
isEnabled = { IncrementalCompilation.isExperimental() })
|
|
||||||
|
|||||||
Reference in New Issue
Block a user