Fix Gradle IC cache version checking

This commit is contained in:
Alexey Tsvetkov
2017-08-24 02:42:24 +03:00
parent cf72b14b34
commit 66a77c7ec2
5 changed files with 22 additions and 16 deletions
@@ -67,10 +67,11 @@ abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractKo
internal val taskBuildDirectory: File
get() = File(File(project.buildDir, KOTLIN_BUILD_DIR_NAME), name).apply { mkdirs() }
private val cacheVersions: List<CacheVersion> =
listOf(normalCacheVersion(taskBuildDirectory),
dataContainerCacheVersion(taskBuildDirectory),
gradleCacheVersion(taskBuildDirectory))
private val cacheVersions: List<CacheVersion>
get() =
listOf(normalCacheVersion(taskBuildDirectory, enabled = incremental),
dataContainerCacheVersion(taskBuildDirectory, enabled = incremental),
gradleCacheVersion(taskBuildDirectory, enabled = incremental))
// indicates that task should compile kotlin incrementally if possible
// it's not possible when IncrementalTaskInputs#isIncremental returns false (i.e first build)
@@ -21,5 +21,5 @@ import java.io.File
internal const val GRADLE_CACHE_VERSION = 4
internal const val GRADLE_CACHE_VERSION_FILE_NAME = "gradle-format-version.txt"
internal fun gradleCacheVersion(dataRoot: File): CacheVersion =
customCacheVersion(GRADLE_CACHE_VERSION, GRADLE_CACHE_VERSION_FILE_NAME, dataRoot)
internal fun gradleCacheVersion(dataRoot: File, enabled: Boolean): CacheVersion =
customCacheVersion(GRADLE_CACHE_VERSION, GRADLE_CACHE_VERSION_FILE_NAME, dataRoot, enabled)